Help understanding reason for mouse look setup

I’ve noticed prominent mouse look scripts use motion actuators on two objects, the x or y axis on the camera or an empty the camera is parented to, and one for the z axis on a separate empty or object.

I wondered why the two objects and when I put both motion actuators on a single object the looking object gradually would rotate on the 3rd axis also, causing a bad tilt. I assume the two objects are needed to avoid the tilting problem.

Why does it do this? And why does it not do it with another parented step in between?

Your talking about the old mouselook. Have a look at raider’s mouselook, its much better.

The explanation for using two objects:
When you have a camera parented to an object and you want that object to be looking around, you don’t want your object turning completely on the x axis every time you move the mouse up and down. Its much easier to just rotate the camera. But then, when you want to rotate the view left and right, you would only move your camera, which would make your character look funny. The reason for the two cameras is simply because it makes the game work. :slight_smile:

He, he, well, yea, but you could have also explained it like this:

There is no technical limitation that prevents one from performing all rotations on the camera; you would just have to make the rotation around the horizontal axis local, while keeping the rotation around the vertical axis global, so as to avoid the unwanted “tilt”.

The additional object is most commonly used as a physics enabled body, so that the camera itself can’t go through walls, and so that the player can interact with other physics bodies freely. Also, applying the steering rotation to the body makes it very easy to setup basic WASD controls, because the mouse induced rotation is already applied, so all you have to do is setup local movements for the body.

Interesting, but if you just wanted the Camera to not go through walls, wouldn’t you just make it dynamic?