procedure TLeft.Update(const SecondsPassed: single; var RemoveMe: TRemoveType);
inherited Update(SecondsPassed, RemoveMe);
with Parent do
TranslationXY := TranslationXY + Vector2(100 * SecondsPassed, 0);
procedure TLeft.Collision(const CollisionDetails: TPhysicsCollisionDetails);
Hello Michalis, thanks for answer. But I’m confused. I saw the exampled that you point. In the example, all components are created in editor, then in the code you can used.
But In my code I created a transform castle. Then I load it and I try to get collision.
I post a zip file with all code,may be can explain better than me (there is some garbage, but excuse me because it is a test code).
Body1 := Box1.FindBehavior(TCastleRigidBody) as TCastleRigidBody;
Body1.OnCollisionEnter := @aLeft.Collision;
and declare Body1: TCastleRigidBody local variable in the routine.
I know – new version is longer. But it is more consistent with other behaviors, we decided for now to get rid of “RigidBody” shortcut that is also connected to deprecated “TRigidBody”. Maybe it will come back one day, I can see how it would be just convenient in this case.