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

Restricts angle between 2 vectors from 2 participants around an axis defined relative to participant 0 to a certain range. More...

#include <types.hpp>

Inheritance diagram for ToyMaker::ConstraintRotation1D:
ToyMaker::ConstraintParametrized< Constraint1DOFConfig, Constraint1DOFParam, 1 > ToyMaker::Constraint< LagrangeCount > ToyMaker::BaseConstraint

Public Member Functions

void applyConstraintPosition (const ParticipantTable &states, float substepSeconds)
 Applies positional constraint to current set of bounds and physics states.
Public Member Functions inherited from ToyMaker::ConstraintParametrized< Constraint1DOFConfig, Constraint1DOFParam, 1 >
 ConstraintParametrized (const Constraint1DOFConfig &config, const std::vector< Constraint1DOFParam > &constraintParameters, float compliance)
 Initializes this constraint with some initial compliance value and constraint parameters.
void setConfig (const Constraint1DOFConfig &config)
 Sets configuration for this constraint.
Constraint1DOFConfig getConfig () const
 Gets the current configuration of this constraint.
void setParameter (BaseConstraint::ParticipantID participant, const Constraint1DOFParam &parameter)
 Adds a parameter for this constraint.
Constraint1DOFParam getParameter (BaseConstraint::ParticipantID participant) const
 Gets parameter belonging to a particular constraint participant.
void removeParameter (BaseConstraint::ParticipantID participant)
 Removes a parameter belonging to a particular constraint participant.
const std::unordered_map< BaseConstraint::ParticipantID, Constraint1DOFParam > & getParameters () const
 Returns all parameters known to this constraint.
Public Member Functions inherited from ToyMaker::Constraint< LagrangeCount >
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.
void resetLagrange () override
 Sets all lagrange multipliers to 0 in preparation for the next physics update.
template<uint8_t ... indices>
void resetLagrange (std::integer_sequence< uint8_t, indices... > sequence)
Public Member Functions inherited from ToyMaker::BaseConstraint
float getCompliance () const
 Gets the current compliance value for this constraint.
virtual void applyConstraintVelocity (const ParticipantTable &states, float substepSeconds)
 Applies velocity-based constraint to current set of bounds and physics states.
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.

Additional Inherited Members

Public Types inherited from ToyMaker::ConstraintParametrized< Constraint1DOFConfig, Constraint1DOFParam, 1 >
using Config
using Parameter
Public Types inherited from ToyMaker::BaseConstraint
using ParticipantID = std::size_t
using ParticipantTable
Static Public Attributes inherited from ToyMaker::ConstraintParametrized< Constraint1DOFConfig, Constraint1DOFParam, 1 >
static const uint8_t NLagrange
Protected Member Functions inherited from ToyMaker::Constraint< LagrangeCount >
 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

Restricts angle between 2 vectors from 2 participants around an axis defined relative to participant 0 to a certain range.

Member Function Documentation

◆ applyConstraintPosition()

void ConstraintRotation1D::applyConstraintPosition ( const ParticipantTable & states,
float substepSeconds )
virtual

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 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