Method CreateAngularVelocityMotor
CreateAngularVelocityMotor(BodyFrame, BodyFrame, float, float)
Create a AngularVelocityMotor joint. This is an angular motor that will spin around an axis at the specified constant target velocity.
Declaration
public static PhysicsJoint CreateAngularVelocityMotor(BodyFrame bodyAFromJoint, BodyFrame bodyBFromJoint, float targetVelocity, float maxImpulseOfMotor = Infinity)
Parameters
Type | Name | Description |
---|---|---|
BodyFrame | bodyAFromJoint | Specifies the pivot point and axis of rotation in the space of body A. This is the body that has the motor. The BodyFrame parameters should be set as follows: The Position should be set to the pivot position. The Pivot Position is an offset from the center of the body with the motor (bodyA). The Axis is the axis that bodyA will pivot about. Value must be normalized. The Perpendicular Axis must be perpendicular to Axis. Value must be normalized. |
BodyFrame | bodyBFromJoint | Specifies the pivot point and axis of rotation in the space of bodyB. This is the Connected Body. If no body is connected, then bodyB is the World and data should be in world-space. It is recommended to 'Auto Set Connected' this body to bodyA such that they share a pivot point (code is not supported for this not to be enabled) and should be calculated using the following transformation: RigidTransform bFromA = math.mul(math.inverse(worldFromB), worldFromA). The BodyFrame parameters should be set as follows: The Position should be calculated as math.transform(bFromA, PivotPosition); where PivotPosition is the translation in bodyAFromJoint. This is the position of the Pivot relative to the Connected Body. The Axis should be calculated as math.mul(bFromA.rot, axis), where axis is the Axis of bodyAFromJoint. This is the translation of the Axis relative to the Connected Body. Value must be normalized. The Perpendicular Axis should be calculated as perpendicular to Axis (for bodyB). Value must be normalized. |
float | targetVelocity | The target angular velocity around Joint's Axis, in radians/s. |
float | maxImpulseOfMotor | The magnitude of the max impulse that a motor constraint can exert in a single step. This is a motor specific usage that does not represent the impulse threshold to break the motor. |
Returns
Type | Description |
---|---|
PhysicsJoint | A Constraint. |