29#ifndef DY_SOLVER_CONSTRAINT_1D_H
30#define DY_SOLVER_CONSTRAINT_1D_H
32#include "foundation/PxVec3.h"
34#include "DyArticulationUtils.h"
35#include "DySolverConstraintTypes.h"
36#include "DySolverBody.h"
37#include "PxConstraintDesc.h"
38#include "DySolverConstraintDesc.h"
56 PxReal linBreakImpulse;
57 PxReal angBreakImpulse;
61 PxReal linearInvMassScale0;
62 PxReal angularInvMassScale0;
63 PxReal linearInvMassScale1;
64 PxReal angularInvMassScale1;
112 h.type = PxU8(isExtended ? DY_SC_TYPE_EXT_1D : DY_SC_TYPE_RB_1D);
115 h.linearInvMassScale0 = ims.
linear0;
116 h.angularInvMassScale0 = ims.
angular0;
117 h.linearInvMassScale1 = -ims.
linear1;
118 h.angularInvMassScale1 = -ims.
angular1;
124 PxReal _minImpulse, PxReal _maxImpulse)
132 c.minImpulse = _minImpulse;
133 c.maxImpulse = _maxImpulse;
145 PxReal& unbiasedConstant,
146 PxReal& velMultiplier,
147 PxReal& impulseMultiplier,
148 const Px1DConstraint& c,
151 PxReal minRowResponse,
157 PxReal recipResponse = unitResponse <= minRowResponse ? 0 : 1.0f/unitResponse;
163 PxReal a = dt * dt * c.mods.spring.stiffness + dt * c.mods.spring.damping;
164 PxReal b = dt * (c.mods.spring.damping * c.velocityTarget - c.mods.spring.stiffness * c.geometricError);
168 PxReal x = 1.0f/(1.0f+a);
169 constant = unbiasedConstant = x * recipResponse * b;
170 velMultiplier = -x * recipResponse * a;
171 impulseMultiplier = 1.0f-x;
175 PxReal x = unitResponse == 0.f ? 0.f : 1.0f/(1.0f+a*unitResponse);
176 constant = unbiasedConstant = x * b;
177 velMultiplier = -x*a;
178 impulseMultiplier = 1.0f-x;
183 PxReal geomError = c.geometricError * erp;
184 velMultiplier = -recipResponse;
185 impulseMultiplier = 1.0f;
189 unbiasedConstant = constant = recipResponse * c.mods.bounce.restitution*-normalVel;
194 constant = recipResponse * (c.velocityTarget - geomError*recipdt);
195 unbiasedConstant = recipResponse * (c.velocityTarget - c.forInternalUse*recipdt);
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_INLINE bool isFinite() const
returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)
Definition PxVec3.h:156
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_COMPILE_TIME_ASSERT(exp)
Definition PxPreprocessor.h:428
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxIsFinite(float f)
returns true if the passed number is a finite floating point number as opposed to INF,...
Definition PxMath.h:326
Definition CmSpatialVector.h:483
Definition DySolverConstraint1D.h:98
Definition DySolverConstraint1D.h:71
PxReal minImpulse
Lower bound on impulse magnitude
Definition DySolverConstraint1D.h:88
PxVec3 lin1
linear velocity projection (body 1)
Definition DySolverConstraint1D.h:76
PxReal constant
constraint constant term
Definition DySolverConstraint1D.h:74
PxVec3 ang0
angular velocity projection (body 0)
Definition DySolverConstraint1D.h:79
PxReal appliedForce
applied force to correct velocity+bias
Definition DySolverConstraint1D.h:90
PxReal velMultiplier
constraint velocity multiplier
Definition DySolverConstraint1D.h:80
PxVec3 ang0Writeback
unscaled angular velocity projection (body 0)
Definition DySolverConstraint1D.h:85
PxVec3 ang1
angular velocity projection (body 1)
Definition DySolverConstraint1D.h:82
PxReal maxImpulse
Upper bound on impulse magnitude.
Definition DySolverConstraint1D.h:89
PxVec3 lin0
linear velocity projection (body 0)
Definition DySolverConstraint1D.h:73
PxReal impulseMultiplier
constraint impulse multiplier
Definition DySolverConstraint1D.h:83
PxReal unbiasedConstant
constraint constant term without bias
Definition DySolverConstraint1D.h:77
@ eRESTITUTION
whether the restitution model should be applied to generate the target velocity. Mutually exclusive w...
Definition PxConstraintDesc.h:67
@ eACCELERATION_SPRING
whether the constraint is a force or acceleration spring. Only valid if eSPRING is set.
Definition PxConstraintDesc.h:66
@ eSPRING
whether the constraint is a spring. Mutually exclusive with eRESTITUTION. If set, eKEEPBIAS is ignore...
Definition PxConstraintDesc.h:65
Struct for specifying mass scaling for a pair of rigids.
Definition PxConstraintDesc.h:184
PxReal angular1
multiplier for inverse MoI of body1
Definition PxConstraintDesc.h:195
PxReal linear0
multiplier for inverse mass of body0
Definition PxConstraintDesc.h:192
PxReal angular0
multiplier for inverse MoI of body0
Definition PxConstraintDesc.h:193
PxReal linear1
multiplier for inverse mass of body1
Definition PxConstraintDesc.h:194