Physics
(NOTE) Information to represent a constraint to be solved. The main information that needs to be set here is the Jacobian and error. A constraint will enforce that the relative velocities along the Jacobian are equal to zero (ignoring error correction or motors).
Methods | Properties | Base Classes | Derived Classes |
---|---|---|---|
ComputeMotor | Active | referencecountedeventobject | |
ComputeSpring | Angular0 | ||
DetachFromOwner | Angular1 | ||
IsOwned | Baumgarte | ||
SetErrorAndBias | Bias | ||
SetJacobian | EffectiveMass | ||
Error | |||
Gamma | |||
Impulse | |||
Linear0 | |||
Linear1 | |||
MaxImpulse | |||
MinImpulse | |||
Owner | |||
SolvePosition |
Properties
Active : boolean
Is this constraint currently active?
var Active : Boolean
Angular0 : real3
Angular portion of objectA's Jacobian.
var Angular0 : Real3
Angular1 : real3
Angular portion of objectB's Jacobian.
var Angular1 : Real3
Baumgarte : real
The baumgarte term used to correct error. This should typically be set in initialization (per constraint) and then left alone. Default value is 5.
var Baumgarte : Real
Bias : real
The bias is used to apply energy into the system. Typically, bias is combined with Error and Baumgarte to fix error. Bias is also used for motors and springs to drive the constraint.
var Bias : Real
EffectiveMass : real
The effective mass of the constraint. This is typically set by calling SetJacobian.
var EffectiveMass : Real
Error : real
The error of the constraint. This should typically be set via the SetError function.
var Error : Real
Gamma : real
Gamma is used to soften constraints. This should typically never be manually set. Instead, it is set when configuring the constraint to act like a spring.
var Gamma : Real
Impulse : real
The total accumulated impulse of this constraint. If you want to not use warm-starting then clear this value every frame.
var Impulse : Real
Linear0 : real3
Linear portion of objectA's Jacobian.
var Linear0 : Real3
Linear1 : real3
Linear portion of objectB's Jacobian.
var Linear1 : Real3
MaxImpulse : real
The max impulse magnitude allowed for the constraint.
var MaxImpulse : Real
MinImpulse : real
The min impulse magnitude allowed for the constraint.
var MinImpulse : Real
Owner : customjoint
read-only
What joint currently owns this constraint.
var Owner : CustomJoint
SolvePosition : boolean
Should this constraint solve position directly or use baumgarte correction? Toggling SolvePosition should be done before setting any other values (ideally in initialization). Setting a constraint to be a motor or a spring will turn off position correction as an error bias must be used to solve those scenarios.
var SolvePosition : Boolean
Methods
ComputeMotor : Void
Sets this constraint as a motor (i.e. a constraint that drives movement along the Jacobian direction at a certain speed). The motor has a min and max impulse value that can be solved (typically -value, +value). If you set this as a motor, you should do so last. Motors should typically be their own constraint unlike springs. |Name|Type|Description| |---|---|---| |targetSpeed|real| | |minImpulse|real| | |maxImpulse|real| |
function ComputeMotor(targetSpeed : Real, minImpulse : Real, maxImpulse : Real)
ComputeSpring : Void
Given the currently set mass and error, fix the constraint to be soft (i.e. solve the constraint like a spring). The spring fixes the constraint using the given frequency (oscillations per second) and damping ratio (0 is no damping, 1 is critical damping). |Name|Type|Description| |---|---|---| |frequencyHz|real| | |dampRatio|real| |
function ComputeSpring(frequencyHz : Real, dampRatio : Real)
DetachFromOwner : Void
Remove this constraint from whatever joint owns it. This is equivalent to "this.Owner.RemoveConstraint(this)". |Name|Type|Description| |---|---|---|
function DetachFromOwner()
IsOwned : boolean
Is this constraint currently owned by a joint? (Equivalent to "this.Owner != null"). |Name|Type|Description| |---|---|---|
function IsOwned() : Boolean
SetErrorAndBias : Void
Set the position error of the constraint. This also sets the bias of the constraint (used to actually correct the error). If you want to set this constraint as a motor you should not call this function (or call it first). If you want to set this as a spring then make sure you call this first. |Name|Type|Description| |---|---|---| |error|real| |
function SetErrorAndBias(error : Real)
SetJacobian : Void
Set the Jacobian of this constraint (and the effective mass). |Name|Type|Description| |---|---|---| |linear0|real3| | |angular0|real3| | |linear1|real3| | |angular1|real3| |
function SetJacobian(linear0 : Real3, angular0 : Real3, linear1 : Real3, angular1 : Real3)