Method CreateLinearVelocityMotor
CreateLinearVelocityMotor(BodyFrame, BodyFrame, float, float)
Create a LinearVelocityMotor joint. This is a motorized prismatic joint type that will drive to a constant target relative velocity, in a specified direction.
Declaration
public static PhysicsJoint CreateLinearVelocityMotor(BodyFrame bodyAFromJoint, BodyFrame bodyBFromJoint, float target, float maxImpulseOfMotor = Infinity)
Parameters
Type | Name | Description |
---|---|---|
BodyFrame | bodyAFromJoint | Specifies the anchor point and axis of rotation in the space of bodyA. This is the body that has the motor. The BodyFrame parameters should be set as follows: The Position should be set to the anchor position. The Anchor Position is an offset from the center of the body with the motor (bodyA), representing the anchor point of translation. The Axis is the normalized direction of the motor rotated relative to the orientation of bodyA. Value must be normalized. The Perpendicular Axis should be calculated as perpendicular to Axis. Value must be normalized. |
BodyFrame | bodyBFromJoint | Specifies the pivot point and axis of alignment 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, AnchorPosition); where AnchorPosition is the translation in bodyAFromJoint. This is the position of the Anchor 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 | target | The target velocity, in m/s. The motor will drive the bodies to this relative speed, along the Joint's Axis. |
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. |