This time I make it short:
How can I stop the moveWithCollisions() function, to stop a mesh, after it reached a certain point?
Or maybe what I need, is to stop the scene.registerBeforeRender() function in which I call moveWithCollisions().
I know I also could use a normal animation, but I want to keep the collisions of the unit.
In line 136 is the move() function which I call in line 92.
Leftclick a small box and rightclick somewhere on the ground afterwards.
The unit will go to the direction and then stop (with alert).
You can rightclick the big box to create another unit and do the same.
I managed to let the unit stop, at clicked point on the ground. But when try to move again, it goes in a slight different direction, because the first moveWithCollision() is still active and it will never reach the second clicked point.
Greetings and thanks