book_4_sparkGenerated
code_blocksInput

Description

The Keyframed field of the PhysicsMotionType enumeration 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 or collisions.

Usage

Use the Keyframed motion type when you want to control the movement of a physics body manually, without any automatic physics simulation. This is ideal for objects that need to follow a specific path or animation sequence.

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