Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
1.0.0:physics [2023/03/16 08:58] – [Example] admin | 1.0.0:physics [2023/03/16 09:04] – [Colliders] admin |
---|
| |
On collider registration you push starting transformation information and shape data to the physics world: | On collider registration you push starting transformation information and shape data to the physics world: |
* AddBoxCollider() | ^Method^ |
* AddSphereCollider() | |procedure AddBoxCollider(const AControl : TControl3D; const APrefab : TGorillaColliderSettings);|Add a box collider for a specific TControl3D instance to the physics system. At first you will need to create a TGorillaColliderSettings structure, where to define the body type (static, dynamic, kinematic)| |
* AddCapsuleCollider() | |procedure AddSphereCollider(const AControl : TControl3D; const APrefab : TGorillaColliderSettings);|Add a spherical collider for a specific TControl3D instance to the physics system. At first you will need to create a TGorillaColliderSettings structure, where to define the body type (static, dynamic, kinematic)| |
* AddParticleCollider() | |procedure AddCapsuleCollider(const AControl : TControl3D; const APrefab : TGorillaColliderSettings; const ARadius, AHeight : Single);|Add a capsule collider for a specific TControl3D instance to the physics system. At first you will need to create a TGorillaColliderSettings structure, where to define the body type (static, dynamic, kinematic)| |
* AddTerrainCollider() | |procedure AddParticleCollider(const AData : Pointer; const AType : PTypeInfo; const APrefab : TGorillaColliderSettings; const ATransformation : TMatrix3D; const ARadius : Single; out ABody : TQ3Body);|Add a particle collider for a specific pointer value to the physics system. At first you will need to create a TGorillaColliderSettings structure, where to define the body type (static, dynamic, kinematic). Also provide a starting transformation matrix and a radius of the particle. The procedure will return a TQ3Body instance as pointer which should be linked with your particle structure (AParticle). This method is automatically used by the physics particle influencer class.| |
* AddMeshCollider() | |procedure AddTerrainCollider(const AMesh : TCustomMesh; const APrefab : TGorillaColliderSettings);|Add a terrain collider for a specific TCustomMesh (terrain) instance to the physics system. At first you will need to create a TGorillaColliderSettings structure, where to define the body type (static, dynamic, kinematic). Of course the body type is flexible, but for terrains you should use the static body type.| |
| |procedure AddTerrainCollider(const ATerrain : TGorillaMesh; const APrefab : TGorillaColliderSettings);|Add a terrain collider for a specific TGorillaMesh instance to the physics system. At first you will need to create a TGorillaColliderSettings structure where to define the body type (static, dynamic, kinematic). Of course the body type is flexible, but for terrains you should use the static body type.| |
| |procedure AddMeshCollider(const AMesh : TCustomMesh; const APrefab : TGorillaColliderSettings);|Add a capsule collider for a specific TCustomMesh instance to the physics system. At first you will need to create a TGorillaColliderSettings structure where to define the body type (static, dynamic, kinematic)| |
| |procedure AddMeshCollider(const AMesh : TGorillaMesh; const APrefab : TGorillaColliderSettings);|Add a capsule collider for a specific TGorillaMesh instance to the physics system. At first you will need to create a TGorillaColliderSettings structure where to define the body type (static, dynamic, kinematic)| |
| |
From there on the physics controller will compute transformation based on its own universe. | From there on the physics controller will compute transformation based on its own universe. |
| |
// Add a sphere collider for each instance with the maximum size of a side as radius | // Add a sphere collider for each instance with the maximum size of a side as radius |
| // or use another internal registration method, like DoAddBoxCollider, DoAddCapsuleCollider, ... |
DoAddSphereCollider(AData, TypeInfo(TGorillaMeshInstance), APrefab, | DoAddSphereCollider(AData, TypeInfo(TGorillaMeshInstance), APrefab, |
LTransform, Max(ASize.X, Max(ASize.Y, ASize.Z)), ABody); | LTransform, Max(ASize.X, Max(ASize.Y, ASize.Z)), ABody); |
end; | end; |
</file> | </file> |
| |
| When you have declared this kind of helper class in your unit, the TGorillaPhysicsSystem component will then show you a new method to be callable "AddInstanceCollider". |
| |
| |
Next step: [[fmodaudio|FMOD Audio]] | Next step: [[fmodaudio|FMOD Audio]] |