Class AngularMotor
- Namespace
- Jitter2.Dynamics.Constraints
- Assembly
- Jitter2.dll
Drives relative angular velocity about an axis attached to each body.
public class AngularMotor : Constraint<AngularMotor.AngularMotorData>, IDebugDrawable
- Inheritance
-
AngularMotor
- Implements
- Inherited Members
Properties
LocalAxis1
Gets the motor axis on the first body in local space.
public JVector LocalAxis1 { get; }
Property Value
LocalAxis2
Gets the motor axis on the second body in local space.
public JVector LocalAxis2 { get; }
Property Value
MaximumForce
Gets or sets the maximum torque the motor can apply.
[Obsolete("Use MaximumTorque instead.")]
public float MaximumForce { get; set; }
Property Value
Remarks
Use MaximumTorque instead.
MaximumTorque
Gets or sets the maximum torque the motor can apply.
public float MaximumTorque { get; set; }
Property Value
- float
Default is 0. Must be non-negative. Positive infinity allows unlimited torque.
Remarks
Changing the value wakes the connected bodies.
Exceptions
- ArgumentOutOfRangeException
Thrown when
valueis negative or NaN.
TargetVelocity
Gets or sets the target angular velocity in radians per second.
public float TargetVelocity { get; set; }
Property Value
- float
Default is 0.
Remarks
Changing the value wakes the connected bodies.
Methods
Create()
Called when the world creates this constraint. Override to set DispatchId to the ID returned by registering the constraint's solver methods.
protected override void Create()
DebugDraw(IDebugDrawer)
Draws a debug visualization of this constraint.
public override void DebugDraw(IDebugDrawer drawer)
Parameters
drawerIDebugDrawerThe debug drawer to receive visualization primitives.
Exceptions
- NotImplementedException
Thrown if the derived class does not override this method.
DebugDraw(IDebugDrawer, in DebugDrawSettings)
Draws this constraint using the supplied visualization settings. Custom constraints that only override DebugDraw(IDebugDrawer) use their default visualization.
public override void DebugDraw(IDebugDrawer drawer, in DebugDrawSettings settings)
Parameters
drawerIDebugDrawersettingsDebugDrawSettings
Initialize(JVector)
Initializes the motor with the same axis for both bodies.
public void Initialize(JVector axis)
Parameters
axisJVectorThe motor axis in world space, used for both bodies.
Exceptions
- ArgumentException
Thrown when
axisis zero or contains a non-finite value.
Initialize(JVector, JVector)
Initializes the motor with separate axes for each body.
public void Initialize(JVector axis1, JVector axis2)
Parameters
axis1JVectorThe motor axis on the first body in world space.
axis2JVectorThe motor axis on the second body in world space.
Remarks
The axes rotate with their respective bodies and are normalized internally. Default values: TargetVelocity = 0, MaximumTorque = 0.
Exceptions
- ArgumentException
Thrown when
axis1oraxis2is zero or contains a non-finite value.
IterateAngularMotor(ref ConstraintData, in TimeStep)
public static void IterateAngularMotor(ref ConstraintData constraint, in TimeStep timeStep)
Parameters
constraintConstraintDatatimeStepTimeStep
PrepareForIterationAngularMotor(ref ConstraintData, in TimeStep)
public static void PrepareForIterationAngularMotor(ref ConstraintData constraint, in TimeStep timeStep)
Parameters
constraintConstraintDatatimeStepTimeStep
ResetWarmStart()
Clears impulses saved from the previous solve, without changing constraint settings.
public override void ResetWarmStart()
Remarks
Use after restoring a saved state or making a sudden change to the bodies, when impulses from their previous state should no longer be reused.
ToString()
Returns a short description of the constraint's ID, connected bodies, and state.
public override string ToString()