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 in scenarios where the physics simulation is driven by animation or other scripted events, rather than by dynamic physics interactions.
Usage
Use the KeyframeBody
property to retrieve or manipulate the PhysicsBody
of a collider when it is in a keyframe state. This can be useful for setting up or modifying the physical properties of the collider in a controlled manner, such as during animations or scripted sequences.
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.Rotation = Rotation.Identity;
}