Page 1 of 1

resetting camera position

Posted: Tue Apr 25, 2006 7:23 pm
by Sd-RawK-Cab25
hi all,

ok first off, i'm trying to implement a reset button, where when the 'R' key is pressed, the camera goes back to the initial start point.

now my environment is basically a multi storey building. i've successfully implemented the key press event (using TTinyEvent class by Emil Halim) and the camera does go to its initial position.....only on certain instances.

What I do understand from the engine (and later from searches on this forum) is that I should be disabling the collisionResponseAnimator from the camera by using camera->removeAnimators, and then resetting the position using camera->setPosition, and then adding the animator back using camera->addAnimator(anim).

So basically I start off in a room, and when i get out of the room, the reset position function works fine only if you press 'R' near the intial start point. At other points (normally further points), when I hit reset, the camera tries to go to the point, but it gets blocked by the model. It's as if the animator is added 'too quickly', before the camera could get to the initial position.

Now why is this happening? I tried to comment the line where it adds the animator to the camera and everything worked fine, except there's no collision detection obviously.

- My environment has seperate meshes and for each mesh I applied a selector, then used metaTriangleSelector to add everything, then passing it to the camera.

- For each mesh, I add the selectors in the main function, before the while(device->run()) loop.

- the keypress event code is done in the while(device->run()) loop; the removing of animators, resetting of cam position and readdition of animator is done here

- i already disabled dropping the animator in the main function.

anyone knows what's wrong?

thanks in advanced for any help!