Gorilla.Physics.Q3.Body
Unit Gorilla.Physics.Q3.Body.pasClasses
- TQ3Body = class ( TObject )
Records
- record TQ3BodyDef
Enumerations
- enum TQ3BodyType = ( eStaticBody, eDynamicBody, eKinematicBody ) ;
- enum TQ3BodyState = ( eAwake, eActive, eAllowSleep, eIsland, eStatic, eDynamic, eKinematic, eLockRotAxisX, eLockRotAxisY, eLockRotAxisZ, eLockMoveAxisX, eLockMoveAxisY, eLockMoveAxisZ ) ;
Constants
Mics. types
- type PQ3BodyDef = pointer to TQ3BodyDef;
TQ3BodyType
Type of body (static, dynamic or kinematic)
Remarks
A body is defined by one of these 3 kinds.
Static bodies will not be move or influenced by mass and impulses. Use this type for defining a plane / floor.
Dynamic bodies will move, handle forces influenced by mass and impulses. Use this type by default for any kind of physics-engine handled instances.
Kinematic bodies will be moved, but will not be influenced by mass and impulses. Use this type as an alternative to dynamic bodies.
Static bodies have no Rigidbody component attached to them, so the physics engine does not consider them to be moving. (Avoid moving these frequently or you'll violate that expectation) Use static colliders for level geometry like the ground and immovable walls, or stationary trigger volumes. Static colliders on their own won't set off trigger/collision messages, unless there's a Rigidbody on the other participant. Dynamic bodies have a Rigidbody component attached to them and their eKinematic flag is not set. These objects move at the whims of physics according to their velocities/angular velocities and the forces/torques and collision impacts exerted on them. The physics engine takes responsibility for resolving their collisions with static, kinematic, and other dynamic objects and rebounding them as needed. Use these for basic physics objects you want to be able to stack & topple and have them behave plausibly with minimal intervention, or for objects that you want to steer in a physics-focused way, like a rocketship. Kinematic bodies have a Rigidbody component with a set eKinematic flag. This tells the physics engine "this object moves, but I'll handle that part" — the kinematic object will process collisions with other rigidbodies, but only dynamic objects will automatically react by bouncing away, and cause messages to be sent. The kinematic object itself won't move except how you tell it to with MovePosition or MoveRotation — its velocity won't automatically integrate each timestep. Use this for objects that you want to control in ways that don't behave like simple physics bodies — like a bipedal character controller or highly custom vehicle controls. Use physics queries like overlap checks and shape casts to scan for collisions preemptively, since they won't stop your object automatically.
TQ3BodyState
State of body
Remarks
A body can handle multiple states, like information about the body-type, if it's awake or if an axis is locked.TQ3BodyDef
Fields
- public Axis :
TPoint3D
- public Angle :
Single
- public Position :
TPoint3D
- public LinearVelocity :
TPoint3D
- public AngularVelocity :
TPoint3D
- public GravityScale :
Single
- public Layers :
Integer
- public UserDataType :
PTypeInfo
- public UserData :
Pointer
- public LinearDamping :
Single
- public AngularDamping :
Single
- public BodyType :
TQ3BodyType
- public AllowSleep :
Boolean
- public Awake :
Boolean
- public Active :
Boolean
- public LockRotAxisX :
Boolean
- public LockRotAxisY :
Boolean
- public LockRotAxisZ :
Boolean
- public LockMoveAxisX :
Boolean
- public LockMoveAxisY :
Boolean
- public LockMoveAxisZ :
Boolean
- public Slop :
Single
Methods
- public constructor Create
(
ADummy :
Integer
)
;
Create a TQ3BodyDef and supply a dummy value due to compiler restrictions for record constructors in elder compiler versions.
Parameters
- ADummy : Integer - Use any value. Only needed for compiler.
TQ3Body
Physics Ridid Body
Remarks
A single body instance can handle multiple colliders (boxes). So you can group similar elements and reduce cpu usage.Ancestors
Members
Fields
- protected FOnUpdate :
TQ3OnBodyUpdate
- protected FOnWakeup :
TNotifyEvent
- protected FOnSleep :
TNotifyEvent
- protected FInvInertiaModel :
TQ3Mat3
- protected FInvInertiaWorld :
TQ3Mat3
- protected FMass :
Single
- protected FInvMass :
Single
- protected FLinearVelocity :
TPoint3D
- protected FAngularVelocity :
TPoint3D
- protected FForce :
TPoint3D
- protected FTorque :
TPoint3D
- protected FTx :
TQ3Transform
- protected FQ :
TQ3Quaternion
- protected FLocalCenter :
TPoint3D
- protected FWorldCenter :
TPoint3D
- protected FSleepTime :
Single
- protected FGravityScale :
Single
- protected FLayers :
Integer
- protected FFlags :
TQ3BodyStates
- protected FColliders :
TQ3Collider
- protected FUserDataType :
PTypeInfo
- protected FUserData :
Pointer
- protected FScene :
TObject
- protected FNext :
TQ3Body
- protected FPrev :
TQ3Body
- protected FIslandIndex :
Integer
- protected FLinearDamping :
Single
- protected FAngularDamping :
Single
- protected FSlop :
Single
- protected FContactList :
Pointer
Methods
- public constructor Create
(
const
Def :
PQ3BodyDef; Scene :
TObject
)
;
- protected function GetGravityScale ( ) : Single ;
- protected procedure SetGravityScale ( const AValue : Single ) ;
- protected function GetForce ( ) : TPoint3D ;
- protected procedure SetForce ( const AValue : TPoint3D ) ;
- protected function GetTorque ( ) : TPoint3D ;
- protected procedure SetTorque ( const AValue : TPoint3D ) ;
- protected function GetIslandIndex ( ) : Integer ;
- protected procedure SetIslandIndex ( const AValue : Integer ) ;
- protected function GetInvInertiaModel ( ) : TQ3Mat3 ;
- protected procedure SetInvInertiaModel ( const AValue : TQ3Mat3 ) ;
- protected function GetInvInertiaWorld ( ) : TQ3Mat3 ;
- protected procedure SetInvInertiaWorld ( const AValue : TQ3Mat3 ) ;
- protected function GetWorldCenter ( ) : TPoint3D ;
- protected procedure SetWorldCenter ( const AValue : TPoint3D ) ;
- protected function GetLinearVelocity ( ) : TPoint3D ;
- protected procedure SetLinearVelocity ( const V : TPoint3D ) ;
- protected function GetAngularVelocity ( ) : TPoint3D ;
- protected procedure SetAngularVelocity ( const V : TPoint3D ) ;
- protected procedure SetLinearDamping ( const AValue : Single ) ;
- protected function GetLinearDamping ( ) : Single ;
- protected procedure SetAngularDamping ( const AValue : Single ) ;
- protected function GetAngularDamping ( ) : Single ;
- protected procedure SetSlop ( const AValue : Single ) ;
- protected function GetSlop ( ) : Single ;
- protected function GetFlags ( ) : TQ3BodyStates ;
- protected procedure SetFlags ( const AValue : TQ3BodyStates ) ;
- protected function GetSleepTime ( ) : Single ;
- protected procedure SetSleepTime ( const AValue : Single ) ;
- protected function GetQuaternion ( ) : TQ3Quaternion ; inline;
- protected function GetUserData ( ) : Pointer ; inline;
- protected function GetUserDataType ( ) : PTypeInfo ; inline;
- protected function GetScene ( ) : TObject ; inline;
- protected function GetMass ( ) : Single ;
- protected function GetInvMass ( ) : Single ;
- protected procedure CalculateMassData ( ) ;
- public function AddCollider
(
const
AClass :
TQ3ColliderClass; const
ADef :
TQ3ColliderDef
)
: TQ3Collider
;
Add a collider to this body.
- public procedure RemoveCollider
(
const
ACollider :
TQ3Collider
)
;
Remove a collider from this body.
- public procedure RemoveAllColliders
(
)
;
Remove all boxes from this body and the broadphase.
- public procedure SynchronizeProxies ( ) ;
- public procedure ApplyLinearForce
(
const
AForce :
TPoint3D
)
;
Adds a force multiplied with the mass to an existing force.
- public procedure SetLinearForce
(
const
AForce :
TPoint3D
)
;
Sets the force multiplied with the mass.
- public procedure ApplyForceAtWorldPoint ( const AForce : TPoint3D; const APoint : TPoint3D ) ;
- public procedure SetForceAtWorldPoint ( const AForce : TPoint3D; const APoint : TPoint3D ) ;
- public procedure ApplyLinearImpulse
(
const
AImpulse :
TPoint3D
)
;
Adds a linear impulse multiplied with the mass to an existing impulse.
- public procedure ApplyLinearImpulseAtWorldPoint ( const AImpulse : TPoint3D; const APoint : TPoint3D ) ;
- public procedure SetLinearImpulseAtWorldPoint ( const AImpulse : TPoint3D; const APoint : TPoint3D ) ;
- public procedure ApplyTorque ( const ATorque : TPoint3D ) ;
- public procedure SetToAwake ( ) ;
- public procedure SetToSleep ( AIgnoreFlag : Boolean = False ) ;
- public function IsAwake ( ) : Boolean ;
- public function GetFirstCollider ( ) : TQ3Collider ;
- public function GetFirstColliderPtr ( ) : PQ3Collider ;
- public function GetFirstContactEdge ( ) : Pointer ;
- public function GetFirstContactEdgePtr ( ) : PPointer ;
- public function GetLocalPoint ( const P : TPoint3D ) : TPoint3D ;
- public function GetLocalVector ( const V : TPoint3D ) : TPoint3D ;
- public function GetWorldPoint ( const P : TPoint3D ) : TPoint3D ;
- public function GetWorldVector ( const V : TPoint3D ) : TPoint3D ;
- public procedure AddWorldCenter ( const V : TPoint3D ) ; inline;
- public function GetVelocityAtWorldPoint ( const P : TPoint3D ) : TPoint3D ;
- public procedure AddLinearVelocity ( const V : TPoint3D ) ; inline;
- public procedure ScaleLinearVelocity ( const V : Single ) ; inline;
- public procedure SetRawLinearVelocity ( const V : TPoint3D ) ; inline;
- public procedure AddAngularVelocity ( const V : TPoint3D ) ; inline;
- public procedure ScaleAngularVelocity ( const V : Single ) ; inline;
- public procedure SetRawAngularVelocity ( const V : TPoint3D ) ; inline;
- public function GetTransform ( ) : TQ3Transform ;
- public function GetTransformRef ( ) : PQ3Transform ;
- public procedure SetTransform
(
const
APosition :
TPoint3D
)
;
overload;
Set transformation (position)
- public procedure SetTransform
(
const
APosition :
TPoint3D; const
AAxis :
TPoint3D; AAngle :
Single
)
;
overload;
Set transformation (position and rotation)
- public procedure SetTransform
(
const
APosition :
TPoint3D; const
AMatrix :
TQ3Mat3
)
;
overload;
Set transformation (position and rotation)
- public procedure SetTransform
(
const
AMatrix :
TQ3Mat3
)
;
overload;
Set transformation (rotation)
- public procedure AddFlag ( const AValue : TQ3BodyStates ) ;
- public procedure RemoveFlag ( const AValue : TQ3BodyStates ) ;
- public function HasFlag ( const AValue : TQ3BodyState ) : Boolean ;
- public procedure AddSleepTime ( const AValue : Single ) ;
- public procedure SetLayers ( const ALayers : Integer ) ;
- public function GetLayers ( ) : Integer ;
- public function GetQuaternionRef ( ) : PQ3Quaternion ; inline;
- public function CanCollide ( const AOther : TQ3Body ) : Boolean ;
- public procedure Update ( ) ; virtual;
- public function GetNextBody ( ) : TQ3Body ;
- public procedure SetNextBody ( const AValue : TQ3Body ) ;
- public function GetPrevBody ( ) : TQ3Body ;
- public procedure SetPrevBody ( const AValue : TQ3Body ) ;
- public procedure Render
(
ARender :
PQ3Render
)
;
Render box wireframes for debugging physics engine.
Properties
- public GravityScale : Single
- public Force : TPoint3D
- public Torque : TPoint3D
- public IslandIndex : Integer
- public InvInertiaModel : TQ3Mat3
- public InvInertiaWorld : TQ3Mat3
- public WorldCenter : TPoint3D
- public LinearVelocity : TPoint3D
- public AngularVelocity : TPoint3D
- public LinearDamping : Single
- public AngularDamping : Single
- public Slop : Single
- public Flags : TQ3BodyStates
- public SleepTime : Single
- public Quaternion : TQ3Quaternion
- public UserDataType : PTypeInfo
- public UserData : Pointer
Is a linked instance or structure represented by a pointer. Use UserDataType property to define which kind of data is linked.
read GetUserData - public Scene : TObject
- public Mass : Single
- public InvMass : Single