First person camera behaviour

Nov 21, 2011 at 8:50 PM

Hello Jason,

I have a question regarding the FirstPersonCamera behaviour. I get kinda awkward rotation behaviour when I move the camera around an object (for example to see it from the side). The initial rotations without moving the camera seem correct. Is this intended?

Best regards mkh

Nov 22, 2011 at 5:18 AM

Can you elaborate on this a little more?  I won't be able to try it out until later tonight, but try to describe the issue that you see.  Is it only during movement, or is it a static thing?  Also, take a look at what your FOV is in the camera creation call - if it too big then it can make rotations seems strange (try for something like pi/4).

- Jason

Nov 22, 2011 at 6:54 AM

Let me try and clarify a little bit more. In the initial state I get correct yaw and pitch rotations (mouse control). When I move the camera (WSADQE-keys) around an object (i.e. to see it from the side) the rotation behaviour changes to yaw and roll. My imagination would be to always have yaw and pitch rotations regardless of the camera position relative to the object. It's independent from the FOV and simultaneous moving and rotating.

Cheers mkh

Nov 22, 2011 at 7:03 AM

If I'm not completely on the wrong track the line where you apply the rotations to the camera matrix has to be changed from "rotation.RotationZYX(...)" to "rotation.Rotation(...)"?! Cheers mkh


Nov 22, 2011 at 8:35 PM

That is at least part of the problem.  I have updated the code and re-committed it - try it out and let me know what you think.

Nov 28, 2011 at 1:54 PM

I figured out why the camera seemed to be acting so strangely...  it turns out that the camera controls that use the keyboard and mouse input are affecting the 'Body' of the first person camera actor.  This is a child to the 'Root' of that same actor, which is where the rotation is normally being set in the initialization of the application.  If I change the camera controls to affect the Root of the actor, then the camera works properly - but then the initialization values are overwritten since the camera controls manage their own copy of the rotation values.

I'll need to think about the best way to fix the behavior, but at least it is well understood now...  Thanks for bringing up the topic!