Description
The Keyframed
field of the PhysicsMotionType
enum represents a motion type where the physics body is not subject to physics simulation. Instead, it can be moved by explicitly setting its position and rotation. This is useful for objects that need to be animated or moved programmatically without being affected by physics forces.
Usage
Use PhysicsMotionType.Keyframed
when you want to control the movement of a physics body manually, without it being influenced by the physics engine. This is ideal for objects that need precise control over their movement, such as animated characters or objects that follow a specific path.
Example
// Example of setting a physics body's motion type to Keyframed
PhysicsBody body = new PhysicsBody();
body.MotionType = PhysicsMotionType.Keyframed;
// Manually set the position and rotation
body.Position = new Vector3(0, 0, 0);
body.Rotation = Rotation.From(0, 90, 0);