Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
1.0.0:physics [2023/03/16 09:13] – [Colliders] admin1.0.0:physics [2023/03/16 14:18] (current) – [Override Collider-Registration] admin
Line 146: Line 146:
  
 ^Property ^Description^ ^Property ^Description^
-|_Type|TGorillaPhysicsBodyType (staticdynamic or kinematic)|+|_Type|TGorillaPhysicsBodyType (TQ3BodyType.eStaticBodyTQ3BodyType.eDynamicBody or TQ3BodyType.eKinematicBody)|
 |LockRotAxisX|Locked rotation on the x axis.| |LockRotAxisX|Locked rotation on the x axis.|
 |LockRotAxisY|Locked rotation on the y axis.| |LockRotAxisY|Locked rotation on the y axis.|
Line 160: Line 160:
 |Active|Is body enabled for physics computation.| |Active|Is body enabled for physics computation.|
 |Data|Setup colliderdata: friction, restitution, density, sensor ...| |Data|Setup colliderdata: friction, restitution, density, sensor ...|
 +|Data.Friction|Friction is a force between two surfaces that are sliding, or trying to slide, across each other. For example, when you try to push a book along the floor, friction makes this difficult. Friction always works in the direction opposite to the direction in which the object is moving, or trying to move.|
 +|Data.Restitution|The coefficient of restitution is a measure of how much kinetic energy remains after the collision of two bodies. Its value ranges from 0 to 1.|
 +|Data.Density|It is the mass of a material substance per unit volume.|
 +|Data.Sensor|A sensor is a device that detects and responds to some type of input from the physical environment.|
 ===== Threading ===== ===== Threading =====
  
Line 379: Line 383:
 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". 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".
  
 +
 +==== Render Colliders ====
 +
 +You can render physics colliders for debugging purposes.
 +
 +The most easy way is to insert a TDummy component into your TGorillaViewport and leave all transformation (position, rotation and scaling) zero, to not affect collider rendering.
 +The add a "OnRender" event with the following code.
 +
 +<file pascal>
 +uses 
 +  Gorilla.Physics.Q3.Renderer;
 +
 +const
 +{$IFDEF DEBUG}
 +  SHOW_PHYSICS_COLLIDERS = true;
 +{$ELSE}
 +  SHOW_PHYSICS_COLLIDERS = false; 
 +{$ENDIF}
 +
 +procedure TForm1.Dummy1Render(Sender: TObject; Context: TContext3D);
 +var LRender : TQ3Render;
 +begin
 +  // Check if we want to see physics colliders
 +  if not SHOW_PHYSICS_COLLIDERS then
 +    Exit;
 +
 +  // Here we render physics colliders for debugging
 +  LRender.Context := Context;
 +  GorillaPhysicsSystem1.Engine.Render(@LRender);
 +end;
 +</file>
  
 Next step: [[fmodaudio|FMOD Audio]] Next step: [[fmodaudio|FMOD Audio]]