Jet
v1.3.3
|
2-D rigid body collider class. More...
#include <jet/rigid_body_collider2.h>
Classes | |
class | Builder |
Front-end to create RigidBodyCollider2 objects step by step. More... | |
Public Member Functions | |
RigidBodyCollider2 (const Surface2Ptr &surface) | |
Constructs a collider with a surface. More... | |
RigidBodyCollider2 (const Surface2Ptr &surface, const Vector2D &linearVelocity, double angularVelocity) | |
Constructs a collider with a surface and other parameters. More... | |
Vector2D | velocityAt (const Vector2D &point) const override |
Returns the velocity of the collider at given point . More... | |
![]() | |
Collider2 () | |
Default constructor. More... | |
virtual | ~Collider2 () |
Default destructor. More... | |
void | resolveCollision (double radius, double restitutionCoefficient, Vector2D *position, Vector2D *velocity) |
double | frictionCoefficient () const |
Returns friction coefficent. More... | |
void | setFrictionCoefficient (double newFrictionCoeffient) |
Sets the friction coefficient. More... | |
const Surface2Ptr & | surface () const |
Returns the surface instance. More... | |
void | update (double currentTimeInSeconds, double timeIntervalInSeconds) |
Updates the collider state. More... | |
void | setOnBeginUpdateCallback (const OnBeginUpdateCallback &callback) |
Sets the callback function to be called when Collider2::update function is invoked. More... | |
Static Public Member Functions | |
static Builder | builder () |
Returns builder fox RigidBodyCollider2. More... | |
Public Attributes | |
Vector2D | linearVelocity |
Linear velocity of the rigid body. More... | |
double | angularVelocity = 0.0 |
Angular velocity of the rigid body. More... | |
Additional Inherited Members | |
![]() | |
typedef std::function< void(Collider2 *, double, double)> | OnBeginUpdateCallback |
Callback function type for update calls. More... | |
![]() | |
void | setSurface (const Surface2Ptr &newSurface) |
Assigns the surface instance from the subclass. More... | |
void | getClosestPoint (const Surface2Ptr &surface, const Vector2D &queryPoint, ColliderQueryResult *result) const |
Outputs closest point's information. More... | |
bool | isPenetrating (const ColliderQueryResult &colliderPoint, const Vector2D &position, double radius) |
Returns true if given point is in the opposite side of the surface. More... | |
2-D rigid body collider class.
This class implements 2-D rigid body collider. The collider can only take rigid body motion with linear and rotational velocities.
|
explicit |
Constructs a collider with a surface.
jet::RigidBodyCollider2::RigidBodyCollider2 | ( | const Surface2Ptr & | surface, |
const Vector2D & | linearVelocity, | ||
double | angularVelocity | ||
) |
Constructs a collider with a surface and other parameters.
|
static |
Returns builder fox RigidBodyCollider2.
Returns the velocity of the collider at given point
.
Implements jet::Collider2.
double jet::RigidBodyCollider2::angularVelocity = 0.0 |
Angular velocity of the rigid body.
Vector2D jet::RigidBodyCollider2::linearVelocity |
Linear velocity of the rigid body.