Go to the documentation of this file.
7 #ifndef INCLUDE_JET_COLLIDER2_H_
8 #define INCLUDE_JET_COLLIDER2_H_
32 typedef std::function<void(
Collider2*,
double,
double)>
54 double restitutionCoefficient,
73 void update(
double currentTimeInSeconds,
double timeIntervalInSeconds);
113 double _frictionCoeffient = 0.0;
122 #endif // INCLUDE_JET_COLLIDER2_H_
Abstract base class for generic collider object.
Definition: collider2.h:24
bool isPenetrating(const ColliderQueryResult &colliderPoint, const Vector2D &position, double radius)
Returns true if given point is in the opposite side of the surface.
double distance
Definition: collider2.h:90
void setSurface(const Surface2Ptr &newSurface)
Assigns the surface instance from the subclass.
void setFrictionCoefficient(double newFrictionCoeffient)
Sets the friction coefficient.
Internal query result structure.
Definition: collider2.h:89
Definition: advection_solver2.h:18
const Surface2Ptr & surface() const
Returns the surface instance.
double frictionCoefficient() const
Returns friction coefficent.
std::function< void(Collider2 *, double, double)> OnBeginUpdateCallback
Callback function type for update calls.
Definition: collider2.h:33
std::shared_ptr< Surface2 > Surface2Ptr
Shared pointer for the Surface2 type.
Definition: surface2.h:109
2-D vector class.
Definition: vector2.h:24
void resolveCollision(double radius, double restitutionCoefficient, Vector2D *position, Vector2D *velocity)
Collider2()
Default constructor.
std::shared_ptr< Collider2 > Collider2Ptr
Shared pointer type for the Collider2.
Definition: collider2.h:118
Vector2D point
Definition: collider2.h:91
void setOnBeginUpdateCallback(const OnBeginUpdateCallback &callback)
Sets the callback function to be called when Collider2::update function is invoked.
virtual Vector2D velocityAt(const Vector2D &point) const =0
Returns the velocity of the collider at given point.
Vector2D normal
Definition: collider2.h:92
Vector2D velocity
Definition: collider2.h:93
void update(double currentTimeInSeconds, double timeIntervalInSeconds)
Updates the collider state.
virtual ~Collider2()
Default destructor.
void getClosestPoint(const Surface2Ptr &surface, const Vector2D &queryPoint, ColliderQueryResult *result) const
Outputs closest point's information.