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

Base class for constraints. More...

#include <types.hpp>

Inheritance diagram for ToyMaker::BaseConstraint:
ToyMaker::Constraint< 2 > ToyMaker::Constraint< LagrangeCount > ToyMaker::CollisionConstraint ToyMaker::ParametrizedConstraint< TParameter, LagrangeCount >

Public Types

using ParticipantID = std::size_t
using ParticipantTable

Public Member Functions

float getCompliance () const
 Gets the current compliance value for this constraint.
virtual void applyConstraintPosition (const ParticipantTable &states, float substepSeconds)
 Applies positional constraint to current set of bounds and physics states.
virtual void applyConstraintVelocity (const ParticipantTable &states, float substepSeconds)
 Applies velocity-based constraint to current set of bounds and physics states.
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.

Protected Member Functions

 BaseConstraint (float compliance)
 Initializes this constraint.

Private Attributes

float mCompliance { 0.f }
 Value greater than equal to zero, inverse of the physical stiffness of this constraint.

Detailed Description

Base class for constraints.

Ensures that each constraint provides a method for preprocessing constraint data, and one for applying the constraint.

Also contains a table of entities that are participating in the constraint.

Member Typedef Documentation

◆ ParticipantTable

using ToyMaker::BaseConstraint::ParticipantTable
Initial value:
std::unordered_map<
ParticipantID,
std::pair<
std::reference_wrapper<ObjectBounds>,
std::reference_wrapper<PhysicsState>
>
>

Member Function Documentation

◆ applyConstraintPosition()

virtual void ToyMaker::BaseConstraint::applyConstraintPosition ( const ParticipantTable & states,
float substepSeconds )
inlinevirtual

Applies positional constraint to current set of bounds and physics states.

Will update values stored in ObjectBounds and PhysicsLocal to maintain the constraint and update its own compliance parameters

Reimplemented in ToyMaker::CollisionConstraint.

◆ applyConstraintVelocity()

virtual void ToyMaker::BaseConstraint::applyConstraintVelocity ( const ParticipantTable & states,
float substepSeconds )
inlinevirtual

Applies velocity-based constraint to current set of bounds and physics states.

Will update values stored in ObjectBounds and PhysicsLocal to maintain the constraint and update its own compliance parameters

Reimplemented in ToyMaker::CollisionConstraint.

◆ resetLagrange()

virtual void ToyMaker::BaseConstraint::resetLagrange ( )
inlinevirtual

Resets all lagrange multipliers, preparing them for a new sequence of constraint solve substeps.

Reimplemented in ToyMaker::Constraint< LagrangeCount >.

Member Data Documentation

◆ mCompliance

float ToyMaker::BaseConstraint::mCompliance { 0.f }
private

Value greater than equal to zero, inverse of the physical stiffness of this constraint.

Part of extended position based dynamics implementation.

A compliance of 0 implies infinite stiffness.


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