Class TPhysicsProperties

Unit

Declaration

type TPhysicsProperties = class(TComponent)

Description

Configure physics simulation calculation.

Hierarchy

Overview

Fields

Public nested const DefaultAngularVelocityRK4Integration = false;
Public nested const DefaultLinearVelocityRK4Integration = false;
Public nested const DefaultFrequency = 60.0;
Public nested const DefaultMaxPhysicsTicksPerUpdate = 5;
Public nested const DefaultGravityStrength = 9.81;

Methods

Public constructor Create(AOwner: TComponent); override;

Properties

Published property AngularVelocityRK4Integration: Boolean read FAngularVelocityRK4Integration write SetAngularVelocityRK4Integration default DefaultAngularVelocityRK4Integration;
Published property LinearVelocityRK4Integration: Boolean read FLinearVelocityRK4Integration write SetLinearVelocityRK4Integration default DefaultLinearVelocityRK4Integration;
Published property Frequency: Single read FFrequency write SetFrequency default DefaultFrequency;
Published property GravityStrength: Single read FGravityStrength write FGravityStrength default DefaultGravityStrength;
Published property MaxPhysicsTicksPerUpdate: Cardinal read FMaxPhysicsTicksPerUpdate write FMaxPhysicsTicksPerUpdate default DefaultMaxPhysicsTicksPerUpdate;

Description

Fields

Public nested const DefaultAngularVelocityRK4Integration = false;
 
Public nested const DefaultLinearVelocityRK4Integration = false;
 
Public nested const DefaultFrequency = 60.0;
 
Public nested const DefaultMaxPhysicsTicksPerUpdate = 5;
 
Public nested const DefaultGravityStrength = 9.81;
 

Methods

Public constructor Create(AOwner: TComponent); override;
 

Properties

Published property AngularVelocityRK4Integration: Boolean read FAngularVelocityRK4Integration write SetAngularVelocityRK4Integration default DefaultAngularVelocityRK4Integration;

Use a more precise (but also more expensive) method for simulating angular velocity. The "RK4" refers to Runge–Kutta method.

Published property LinearVelocityRK4Integration: Boolean read FLinearVelocityRK4Integration write SetLinearVelocityRK4Integration default DefaultLinearVelocityRK4Integration;

Use a more precise (but also more expensive) method for simulating linear velocity. The "RK4" refers to Runge–Kutta method.

Published property Frequency: Single read FFrequency write SetFrequency default DefaultFrequency;

How often should the physics simulation run in a second. Larger values increase accuracy (up to a certain point), but also increase the CPU overhead.

Published property GravityStrength: Single read FGravityStrength write FGravityStrength default DefaultGravityStrength;

Physics gravity is set using the -GravityUp vector (from main camera) multiplied with GravityStrength.

Published property MaxPhysicsTicksPerUpdate: Cardinal read FMaxPhysicsTicksPerUpdate write FMaxPhysicsTicksPerUpdate default DefaultMaxPhysicsTicksPerUpdate;

Non-zero value avoids the "spiral of death" when the physics takes a long time to calculate.

When the value is zero, physics makes always as many steps as necessary, to advance the time by 1 / Frequency steps. This means that if physics takes a long time to calculate, next time it will take even longer time to calculate (it will need more steps), thus we have a "spiral of death" that leads to lower and lower FPS.


Generated by PasDoc 0.16.0.