Description
The LocalTransform
property of the PhysicsPoint
struct provides a Transform
that is relative to the associated PhysicsBody
. This transform includes the local position and rotation offsets, with a scale factor of 1. It is useful for determining the position and orientation of a point in relation to its parent physics body.
Usage
Use the LocalTransform
property when you need to access or modify the transform of a point relative to its parent physics body. This is particularly useful in scenarios involving joints or other physics interactions where the relative position and orientation are important.
Example
// Example of accessing the LocalTransform property
PhysicsBody body = new PhysicsBody();
PhysicsPoint point = new PhysicsPoint(body, new Vector3(1, 0, 0), Rotation.Identity);
// Access the local transform
Transform localTransform = point.LocalTransform;
// Output the local position and rotation
Vector3 localPosition = localTransform.Position;
Rotation localRotation = localTransform.Rotation;
// Use the local transform for further calculations or modifications
// For example, adjusting the local position
localTransform.Position += new Vector3(0, 1, 0);