Class AngularMotor
- Namespace
- Jitter2.Dynamics.Constraints
- Assembly
- Jitter2.dll
Represents a motor that drives relative angular velocity between two axes fixed in the reference frames of their respective bodies.
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 force the motor can apply.
public float MaximumForce { get; set; }
Property Value
- float
Default is 0. Must be non-negative.
Exceptions
- ArgumentOutOfRangeException
Thrown when
valueis negative.
TargetVelocity
Gets or sets the target angular velocity in radians per second.
public float TargetVelocity { get; set; }
Property Value
- float
Default is 0.
Methods
Create()
Sets the Iterate and PrepareForIteration function pointer fields on this instance. Override this in derived classes to assign the correct solver methods. The pointers are later written into ConstraintData when the constraint is enabled.
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.
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.
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
Stores the axes in local frames. Both axes are normalized internally. Default values: TargetVelocity = 0, MaximumForce = 0.
IterateAngularMotor(ref ConstraintData, float)
public static void IterateAngularMotor(ref ConstraintData constraint, float idt)
Parameters
constraintConstraintDataidtfloat
PrepareForIterationAngularMotor(ref ConstraintData, float)
public static void PrepareForIterationAngularMotor(ref ConstraintData constraint, float idt)
Parameters
constraintConstraintDataidtfloat