float Delta { get; set; }

robot_2Generated
code_blocksInput

Description

The Delta property provides the time difference, in seconds, between the last frame and the current frame. This is useful for frame-dependent calculations, such as animations or physics updates, where you need to know how much time has passed since the last update.

Usage

Use the Delta property when you need to perform operations that are dependent on the frame rate. For example, if you are moving an object in the game world, you can multiply the movement speed by Delta to ensure consistent movement regardless of the frame rate.

Example

// Example of using RealTime.Delta to move an object
public class MovingObject : GameObject
{
    public float Speed = 5.0f;

    public override void Update()
    {
        // Move the object forward based on the time delta
        Position += Vector3.Forward * Speed * RealTime.Delta;
    }
}