PhysicsBody KeyframeBody { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The KeyframeBody property of the Collider class provides access to the PhysicsBody associated with the collider when it is in a keyframe state. A keyframe body is typically used for animations or scenarios where the physics body is controlled manually rather than by the physics engine.

Usage

Use the KeyframeBody property to retrieve or manipulate the PhysicsBody of a collider when it is in a keyframe state. This is useful in scenarios where you need to manually control the physics body, such as during animations or scripted movements.

Example

// Example of accessing the KeyframeBody property
Collider collider = new Collider();
PhysicsBody keyframeBody = collider.KeyframeBody;

// Check if the keyframe body is not null
if (keyframeBody != null)
{
    // Perform operations on the keyframe body
    keyframeBody.Position = new Vector3(0, 0, 0);
    keyframeBody.Velocity = new Vector3(1, 0, 0);
}