type
TCarBehavior = class(TCastleBehavior)
public
procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
end;
procedure TCarBehavior.Update(const SecondsPassed: Single; var RemoveMe: TRemoveType);
var
T: TVector3;
begin
T := Parent.Translation;
T := T + Vector3(0, 0, 40) * SecondsPassed;
if T.Z > 70 then
T.Z := -50;
Parent.Translation := T;
end;