Ahoy!
First of all: Please execuse me, if this question is dumb or easy to solve or whatever, it is just, that I sat there for several hours yesterday and today, staring at my code, thinking with closed eyes, not finding out, what the problem really is, or how to solve it...
The camera is set up as follows:
There is a mesh attached to a irrbullet rigidbody - moving around
each frame the camera gets moved to the mesh (with a certain offset, for being at the head)
then the mesh is being rotated to fit the cam's rotation.
Nothing is parent or child of each other here...
However, when I am moving to the left (by giving the mesh a leftward velocity) the camera rotates to the left.
same applies for all other movement directions.
My first thought was, that the target of the cam (rotation and target are binded) stays the same, thus the movement leads to a rotation - this would, however, according to the picture in my head lead to rotation in the opposite direction of the movement, not the same dir. as it is the case with my problem...
When I look straight up or down, it even leads to my mesh turning in a small circle...
What could cause this problem/how could I solve it?
Thanks for any help in advance, if you need any code, just ask specifically for what you need in order to help me.
Thanks,
a desperate userrr3
FPSCamera rotates when changing position?!
Re: FPSCamera rotates when changing position?!
Having a camera following the mesh - this just doesn't sound like a use-case for the fps-camera to me (as there you would move the camera and have the mesh follow). You might be better off writing your own camera-animator in such a situation.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: FPSCamera rotates when changing position?!
Can you use the animator to have a response based on user input?CuteAlien wrote:Having a camera following the mesh - this just doesn't sound like a use-case for the fps-camera to me (as there you would move the camera and have the mesh follow). You might be better off writing your own camera-animator in such a situation.
PS sorry for hijacking your thread.
Re: FPSCamera rotates when changing position?!
Yes you can do that. Set ICameraSceneNode::setInputReceiverEnabled to true and I think isEventReceiverEnabled of your animator also must return true.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: FPSCamera rotates when changing position?!
Hello, first of all I'm sorry... I somehow solved the problem with some intense hours of trial and error... However, I have no idea what finally solved the problem..CuteAlien wrote:Having a camera following the mesh - this just doesn't sound like a use-case for the fps-camera to me (as there you would move the camera and have the mesh follow). You might be better off writing your own camera-animator in such a situation.
Thanks for your help anyways! May I ask, what disadvantages I have, when using the fpscamera (with movement speed 0) compared to a maually written camera animator for rotation?
Thanks again
Re: FPSCamera rotates when changing position?!
As long as it works you are fine I guess :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm