Gorilla.Physics.Types Unit Reference
Overview
The Gorilla.Physics.Types unit defines all types, enumerations, and records used by the Gorilla3D physics system: driver types, body types, collider kinds, collider settings, joint types, motor types, and joint prefabs.
Enumerations
TGorillaPhysicsDriverType
| Value |
Description |
Q3Physics |
Q3 Physics Engine (default) |
JOLTPhysics |
JOLT Physics Engine |
CustomPhysics |
Custom physics driver |
TGorillaPhysicsColliderKind
| Value |
Description |
ckBox |
Box collider |
ckSphere |
Sphere collider |
ckCapsule |
Capsule collider |
ckParticle |
Particle collider |
ckMesh |
Mesh collider |
ckTerrain |
Terrain collider |
ckCylinder |
Cylinder collider (Q3 + JOLT) |
ckCone |
Cone collider (Q3 + JOLT) |
ckConvexHull |
Convex hull collider (Q3 + JOLT) |
TGorillaPhysicsBodyType
| Value |
Description |
eStaticBody |
Immovable body. Use for floors, walls |
eKinematicBody |
Moved by code, not affected by forces. Use for platforms, character controllers |
eDynamicBody |
Fully simulated by physics. Use for most interactive objects |
TGorillaPhysicsBodyState
Set type (TGorillaPhysicsBodyStates) with flags:
| Value |
Description |
eAwake |
Body is awake |
eActive |
Body is active |
eAllowSleep |
Body can sleep |
eIsland |
Body is in an island |
eStatic |
Static body |
eDynamic |
Dynamic body |
eKinematic |
Kinematic body |
eLockRotAxisX/Y/Z |
Lock rotation on X/Y/Z axis |
eLockMoveAxisX/Y/Z |
Lock translation on X/Y/Z axis |
TGorillaPhysicsJointType
All joint types are supported by both the Q3 and JOLT backends.
| Value |
Description |
Q3 |
JOLT |
Fixed |
Constrains two bodies together |
Yes |
Yes |
BallAndSocket |
Free rotation on all axes (shoulder/hip) |
Yes |
Yes |
Hinge |
Free rotation on one axis (wheel, carousel) |
Yes |
Yes |
LimitedHinge |
Limited rotation on one axis (finger, knee) |
Yes |
Yes |
Prismatic |
Sliding motion on one axis (sliding door) |
Yes |
Yes |
StiffSpring |
Soft spring maintaining a distance between two bodies |
Yes |
Yes |
Magnet |
Magnetic attraction based on mass |
Yes |
Yes |
Buoyancy |
Floating body on a fluid surface (soft, per-step) |
Yes |
Yes |
Point |
Point-to-point pin (like BallAndSocket) |
Yes |
Yes |
SixDOF |
Six degrees of freedom (per-axis limits) |
Yes |
Yes |
SwingTwist |
Swing cone + twist limit (ragdoll) |
Yes |
Yes |
Distance |
Rigid distance constraint (rope/rod) |
Yes |
Yes |
Cone |
Pin with a swing cone limit |
Yes |
Yes |
RackAndPinion |
Couples pinion rotation to rack translation (needs Ratio) |
Yes |
Yes |
Gear |
Couples two bodies' rotation (needs Ratio) |
Yes |
Yes |
Pulley |
Rope of fixed total length over two pulley points |
Yes |
Yes |
Point, Distance, Cone, SwingTwist, SixDOF, Gear, RackAndPinion and
Pulley were originally JOLT-only; they now have native Q3 solvers as well.
Buoyancy is also implemented for JOLT (native ApplyBuoyancyImpulse).
TGorillaPhysicsMotorType
| Value |
Description |
NoMotor |
Motor deactivated |
RotationMotor |
Constant rotation via quaternion |
AngularVelocityMotor |
Increasing angular velocity |
PositionMotor |
Drive toward a position |
LinearVelocityMotor |
Drive at constant velocity |
VelocityMotor |
Combined angular + linear velocity (wheels, paddlewheels) |
Records
TGorillaPhysicsColliderData
| Field |
Type |
Description |
Friction |
Single |
Surface friction coefficient |
Restitution |
Single |
Bounciness (0 = no bounce, 1 = full) |
Density |
Single |
Mass density |
Sensor |
Boolean |
If True, detects collisions but does not react physically |
TGorillaColliderSettings
Main configuration record for creating colliders.
| Field |
Type |
Description |
_Type |
TGorillaPhysicsBodyType |
Body type (static/dynamic/kinematic) |
LockRotAxisX/Y/Z |
Boolean |
Lock rotation per axis |
LockMoveAxisX/Y/Z |
Boolean |
Lock translation per axis |
LinearDamping |
Single |
Linear velocity damping |
AngularDamping |
Single |
Angular velocity damping |
Radius |
Single |
Override radius for capsule/sphere colliders |
Size |
TPoint3D |
Override size (non-zero overrides auto-detection) |
MinLinearVelocity |
TPoint3D |
Minimum linear velocity limit |
MaxLinearVelocity |
TPoint3D |
Maximum linear velocity limit |
MinAngularVelocity |
TPoint3D |
Minimum angular velocity limit |
MaxAngularVelocity |
TPoint3D |
Maximum angular velocity limit |
Slop |
Single |
Penetration depth slop |
Layers |
Integer |
Collision layer mask (max 8 layers) |
AllowSubColliders |
Boolean |
Allow sub-colliders |
AllowSleep |
Boolean |
Allow body to sleep |
Active |
Boolean |
Enable for physics computation |
Data |
TGorillaPhysicsColliderData |
Friction, restitution, density, sensor |
OnBeginContact |
TOnGorillaPhysicsCollisionEvent |
Per-collider begin contact event |
OnEndContact |
TOnGorillaPhysicsCollisionEvent |
Per-collider end contact event |
Class Methods
class function Create(AType: TGorillaPhysicsBodyType): TGorillaColliderSettings; static;
class function AutoDetectSize(APrefab, AControl, ACollType, ASize): TPoint3D; static;
class function AutoDetectRadius(APrefab, AControl, ACollType, ARadius): Single; static;
class function AutoDetectHeight(APrefab, AControl, ACollType, AHeight): Single; static;
TGorillaPhysicsJointPrefab
Design-time joint configuration (collection item).
Published Properties
| Property |
Type |
Description |
DisplayName |
String |
Joint name |
Enabled |
Boolean |
Enable/disable the joint |
LocalSpace |
Boolean |
Use local space coordinates |
JointType |
TGorillaPhysicsJointType |
Joint type |
ControlA |
TControl3D |
First body |
ControlB |
TControl3D |
Second body |
AnchorA |
TPosition3D |
Anchor on body A |
AnchorB |
TPosition3D |
Anchor on body B |
AxisA |
TPosition3D |
Axis for body A |
AxisB |
TPosition3D |
Axis for body B |
NormalA |
TPosition3D |
Normal for body A |
NormalB |
TPosition3D |
Normal for body B |
AntiGravity |
Boolean |
Negate gravity on joint |
MinValue |
TPosition3D |
Minimum limits (LimitedHinge/Prismatic) |
MaxValue |
TPosition3D |
Maximum limits (LimitedHinge/Prismatic) |
BreakForce |
TPosition3D |
Force threshold for breaking |
BreakTorque |
TPosition3D |
Torque threshold for breaking |
Motor |
TGorillaPhysicsMotorType |
Motor type |
MotorForce |
TPosition3D |
Motor force value |
Stiffness |
Single |
Spring stiffness (Buoyancy JOLT: buoyancy factor) |
Damping |
Single |
Spring damping / fluid drag (Buoyancy) |
RestLength |
Single |
Spring rest length; rope length for Pulley/Distance |
Ratio |
Single |
Transmission ratio for Gear / RackAndPinion / Pulley |
HalfConeAngle |
Single |
Swing cone half-angle (radians) for Cone / SwingTwist |
PlaneHalfConeAngle |
Single |
Second (perpendicular) swing half-angle for an elliptical cone |
FixedPointA |
TPosition3D |
World-space rope endpoint A (Pulley) |
FixedPointB |
TPosition3D |
World-space rope endpoint B (Pulley) |
ConstraintA |
TGorillaPhysicsJointPrefab |
Sub-joint A (pinion hinge / wheel hinge) for Gear / RackAndPinion |
ConstraintB |
TGorillaPhysicsJointPrefab |
Sub-joint B (rack slider / wheel hinge) for Gear / RackAndPinion |
Callback Types
TOnGorillaPhysicsCollisionEvent = procedure(ASender: TObject;
const AOffset, ANormal: TPoint3D;
ABody1, ABody2: TGorillaPhysicsBody) of object;
See Also