Hello, I making a small test to understand applyimpulse.
I created a new blank project. I add a Viewport for 2D.
I added Behaviours to the plane1. I
In my code I wrote:
published
{ Components designed using CGE editor.
These fields will be automatically initialized at Start. }
LabelFps: TCastleLabel;
Plane1: TCastlePlane;
public
(…)
unction TViewMain.Press(const Event: TInputPressRelease): boolean;
var
body: TCastleRigidBody;
begin
Result := inherited;
if Result then Exit; // allow the ancestor to handle keysif Event.IsKey(keySpace) then
begin
body := Plane1.FindBehavior(TCastleRigidBody) as TCastleRigidBody;
Body.ApplyImpulse(Vector3(10000,0,0),Plane1.WorldTranslation);
Exit(true);
end;
end;
But When I run the code, and I press space bar, the plane doesn’t do any thing, only continues moving down by the gravity
What I doing wrong?
Thanks
/BlueIcaro