ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
Loading...
Searching...
No Matches
ToyMaker::CollisionConstraint Struct Reference

Constraint requiring exactly two parameters representing colliding rigid bodies. More...

#include <types.hpp>

Inheritance diagram for ToyMaker::CollisionConstraint:
ToyMaker::Constraint< 2 > ToyMaker::BaseConstraint

Public Member Functions

 CollisionConstraint ()
 Initializes constraint with collision data from two potentially intersecting objects.
void updateCollisionData (const Collision &collision, const PhysicsState &physicsA, const ObjectBounds &boundsA, const ObjectBounds &boundsAPrev, const PhysicsState &physicsB, const ObjectBounds &boundsB, const ObjectBounds &boundsBPrev)
 Caches collision related information shared across position and velocity corrections.
void updateCollisionDataPartial (const PhysicsState &physicsA, const ObjectBounds &boundsA, const PhysicsState &physicsB, const ObjectBounds &boundsB)
 Performs a partial collision data update based on result from previous physics substep.
void applyConstraintPosition (const ParticipantTable &states, float substepSeconds) override
 Separates intersecting/colliding objects and applies static friction.
void applyConstraintVelocity (const ParticipantTable &states, float substepSeconds) override
 Applies dynamic friction.
Public Member Functions inherited from ToyMaker::Constraint< 2 >
void resetLagrange (std::integer_sequence< uint8_t, indices... > sequence)
void applyLagrangeDelta (float delta, uint8_t index)
 Adds a delta to a lagrange value located at index.
const std::array< float, LagrangeCount > & getLagrange () const
 Gets the current Lagrange multiplier values for this constraint.
const std::array< float, LagrangeCount > & getLagrangeDelta () const
 Gets the latest lagrange delta applied to a constraint.
Public Member Functions inherited from ToyMaker::BaseConstraint
float getCompliance () const
 Gets the current compliance value for this constraint.
virtual void resetLagrange ()
 Resets all lagrange multipliers, preparing them for a new sequence of constraint solve substeps.
void setCompliance (float newCompliance)
 Sets the compliance value for this constraint.

Public Attributes

bool mCollided { false }
 Whether or not two objects are currently intersecting (and therefore whether they should be separated).
glm::vec3 mLastPointContactA { 0.f }
 The projected last point of contact of object A participating in this constraint.
glm::vec3 mCurrentPointContactA { 0.f }
 The contact point of object A participating in this constraint in world space.
glm::vec3 mRelativePointContactA { 0.f }
 The contact point of object A relative to its own frame.
glm::vec3 mLastPointContactB { 0.f }
 The projected last point of contact of object B participating in this constraint.
glm::vec3 mCurrentPointContactB { 0.f }
 The contact point of object B participating in this constraint in world space.
glm::vec3 mRelativePointContactB { 0.f }
 The contact point of object B relative to its own frame.
glm::vec3 mContactNormal { 0.f }
 Upon collision, points in the direction object B would need to move in order to be separated from object A.
float mCollisionVelocity { 0.f }
 The velocity of A's point of contact relative to B at the time the collision took place.
float mPenetrationDepth { 0.f }
 The shortest distance an object must move along the contact normal in order to be separated from the object it is intersecting with.

Additional Inherited Members

Public Types inherited from ToyMaker::BaseConstraint
using ParticipantID = std::size_t
using ParticipantTable
Protected Member Functions inherited from ToyMaker::Constraint< 2 >
 Constraint (float compliance)
 Initializes this constraint with some initial compliance value.
Protected Member Functions inherited from ToyMaker::BaseConstraint
 BaseConstraint (float compliance)
 Initializes this constraint.

Detailed Description

Constraint requiring exactly two parameters representing colliding rigid bodies.

Repositions objects such that they no longer intersect along the axis of collision.

Member Function Documentation

◆ applyConstraintPosition()

void CollisionConstraint::applyConstraintPosition ( const ParticipantTable & states,
float substepSeconds )
overridevirtual

Separates intersecting/colliding objects and applies static friction.

Reimplemented from ToyMaker::BaseConstraint.

◆ applyConstraintVelocity()

void CollisionConstraint::applyConstraintVelocity ( const ParticipantTable & states,
float substepSeconds )
overridevirtual

Applies dynamic friction.

Reimplemented from ToyMaker::BaseConstraint.


The documentation for this struct was generated from the following files:
  • ToyMaker_Main/include/toymaker/engine/physics/types.hpp
  • ToyMaker_Main/src/physics/types.cpp