Table of Contents

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

JVector

LocalAxis2

Gets the motor axis on the second body in local space.

public JVector LocalAxis2 { get; }

Property Value

JVector

MaximumForce

Gets or sets the maximum torque the motor can apply.

[Obsolete("Use MaximumTorque instead.")]
public float MaximumForce { get; set; }

Property Value

float

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

drawer IDebugDrawer

The 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

drawer IDebugDrawer
settings DebugDrawSettings

Initialize(JVector)

Initializes the motor with the same axis for both bodies.

public void Initialize(JVector axis)

Parameters

axis JVector

The motor axis in world space, used for both bodies.

Exceptions

ArgumentException

Thrown when axis is 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

axis1 JVector

The motor axis on the first body in world space.

axis2 JVector

The 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 axis1 or axis2 is zero or contains a non-finite value.

IterateAngularMotor(ref ConstraintData, in TimeStep)

public static void IterateAngularMotor(ref ConstraintData constraint, in TimeStep timeStep)

Parameters

constraint ConstraintData
timeStep TimeStep

PrepareForIterationAngularMotor(ref ConstraintData, in TimeStep)

public static void PrepareForIterationAngularMotor(ref ConstraintData constraint, in TimeStep timeStep)

Parameters

constraint ConstraintData
timeStep TimeStep

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

Returns

string