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

Special structure for handling collisions with multiple points of contact accumulated over several timesteps in order to improve stability. More...

#include <types.hpp>

Inheritance diagram for ToyMaker::ConstraintContactManifold:
ToyMaker::BaseConstraint

Public Member Functions

 ConstraintContactManifold ()
 Constraint constructor with a compliance of 0, since our collision constraints are perfectly stiff.
void addContact (const Collision &collision, const PhysicsState &physicsA, const ObjectBounds &boundsA, const ObjectBounds &boundsAPrev, const PhysicsState &physicsB, const ObjectBounds &boundsB, const ObjectBounds &boundsBPrev)
 Attempts to add a contact to the manifold, succeeding when the new contact is not close to any existing contact.
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.
void resetLagrange () override
 Resets all lagrange values associated with this manifold.
uint8_t getNContacts () const
 Returns the number of contacts currently held by this manifold.
void clear ()
 Clears all contacts.
Public Member Functions inherited from ToyMaker::BaseConstraint
float getCompliance () const
 Gets the current compliance value for this constraint.
void setCompliance (float newCompliance)
 Sets the compliance value for this constraint.
template<typename TConstraint, std::enable_if_t< std::is_base_of< ConstraintParametrized< typename TConstraint::Config, typename TConstraint::Parameter, TConstraint::NLagrange >, TConstraint >::value, bool > = true>
void setParameter (ParticipantID participant, const typename TConstraint::Parameter &parameter)
 Sets a parameter belonging to a particular constraint participant.
template<typename TConstraint, std::enable_if_t< std::is_base_of< ConstraintParametrized< typename TConstraint::Config, typename TConstraint::Parameter, TConstraint::NLagrange >, TConstraint >::value, bool > = true>
TConstraint::Parameter getParameter (ParticipantID participant) const
 Gets a parameter associated with a particular constraint participant.
template<typename TConstraint, std::enable_if_t< std::is_base_of< ConstraintParametrized< typename TConstraint::Config, typename TConstraint::Parameter, TConstraint::NLagrange >, TConstraint >::value, bool > = true>
void setConfig (const typename TConstraint::Config &config)
 Sets the configuration of a constraint.
template<typename TConstraint, std::enable_if_t< std::is_base_of< ConstraintParametrized< typename TConstraint::Config, typename TConstraint::Parameter, TConstraint::NLagrange >, TConstraint >::value, bool > = true>
TConstraint::Config getConfig () const
 Gets the configuration of a constraint.

Private Member Functions

void trim (const ObjectBounds &boundsA, const ObjectBounds &boundsB)
 Culls contacts that are no longer considered colliding, or have moved too far from their original locations.

Private Attributes

uint8_t mNContacts { 0 }
 The number of contacts stored by this manifold.
std::array< ConstraintContact, 5 > mContacts {}
 Collection of contact constraints tracked by this manifold.

Additional Inherited Members

Public Types inherited from ToyMaker::BaseConstraint
using ParticipantID = std::size_t
using ParticipantTable
Protected Member Functions inherited from ToyMaker::BaseConstraint
 BaseConstraint (float compliance)
 Initializes this constraint.

Detailed Description

Special structure for handling collisions with multiple points of contact accumulated over several timesteps in order to improve stability.

Tracks up to a maximum of 4 contacts – temporarily 5 when a new contact is added.

Member Function Documentation

◆ applyConstraintPosition()

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

Separates intersecting/colliding objects and applies static friction.

Reimplemented from ToyMaker::BaseConstraint.

◆ applyConstraintVelocity()

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

Applies dynamic friction.

Reimplemented from ToyMaker::BaseConstraint.

◆ resetLagrange()

void ConstraintContactManifold::resetLagrange ( )
overridevirtual

Resets all lagrange values associated with this manifold.

Reimplemented from ToyMaker::BaseConstraint.


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