Warning: Undefined array key "translationlc" in /usr/www/users/fabook/_diggets/doc/v2/lib/plugins/translation/action.php on line 237
Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/fabook/_diggets/doc/v2/lib/plugins/translation/action.php:237) in /usr/www/users/fabook/_diggets/doc/v2/inc/parser/code.php on line 33
Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/fabook/_diggets/doc/v2/lib/plugins/translation/action.php:237) in /usr/www/users/fabook/_diggets/doc/v2/inc/parser/code.php on line 34
Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/fabook/_diggets/doc/v2/lib/plugins/translation/action.php:237) in /usr/www/users/fabook/_diggets/doc/v2/inc/parser/code.php on line 35
type
TForm1 = class(TForm)
GorillaViewport1: TGorillaViewport;
Light1: TLight;
Dummy1: TDummy;
Camera1: TCamera;
GorillaPhysicsSystem1: TGorillaPhysicsSystem;
Plane1: TPlane;
GorillaCube1: TGorillaCube;
PhysicsTimer1: TTimer;
GorillaSphere1: TGorillaSphere;
LightMaterialSource1: TLightMaterialSource;
LightMaterialSource2: TLightMaterialSource;
procedure FormCreate(Sender: TObject);
procedure PhysicsTimer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses
Gorilla.Physics, Gorilla.Physics.Q3.Body;
procedure TForm1.FormCreate(Sender: TObject);
var LPrefab : TGorillaColliderSettings;
begin
// the plane should be a static body, otherwise it will fall in to nothingness
LPrefab := TGorillaColliderSettings.Create(TQ3BodyType.eStaticBody);
GorillaPhysicsSystem1.AddBoxCollider(Plane1, LPrefab);
// the cube is a dynamic / moveable body which collides with the plane and sphere
LPrefab := TGorillaColliderSettings.Create(TQ3BodyType.eDynamicBody);
GorillaPhysicsSystem1.AddBoxCollider(GorillaCube1, LPrefab);
// the sphere is a dynamic / moveable body which collides with the plane and cube
LPrefab := TGorillaColliderSettings.Create(TQ3BodyType.eDynamicBody);
GorillaPhysicsSystem1.AddSphereCollider(GorillaSphere1, LPrefab);
// we activate the physics system
GorillaPhysicsSystem1.Active := true;
// and we need to activate the physics timer for constant updates
PhysicsTimer1.Enabled := true;
end;
procedure TForm1.PhysicsTimer1Timer(Sender: TObject);
begin
{$IFDEF OLDCODE}
GorillaPhysicsSystem1.Step(GorillaPhysicsSystem1.GetDeltaTime());
{$ELSE}
GorillaPhysicsSystem1.Step();
{$ENDIF}
// update visual components rendering after physics have moved/rotated those
GorillaViewport1.Invalidate();
end;