Camera problem.

I’m trying to imitate the movement of a PTZ camera so decided to use a first person camera on my vehicle and add a couple of movement actuators to it. The movement actuators that I added are up, down, left and right, but I seem to be having some strange issues with it.

The main problem is that the camera becomes extremely slanted after I move it in game to position it a couple of times. The rotation axes are all set to local so I don’t know why it keeps doing this. Here is the blend file Camera.blend (653 KB).

Try parenting a little cube to the camera so that you can observe its movements in-game. The issue is that you don’t really want it to rotate relative to the local camera axis, but relative to the vehicle axis. So even when you look up, say, it still rotates relative to the vehicle Z axis, not the camera’s.

Imagine looking up high whilst on a steep downward slope. In a real vehicle without mounted camera it would rotate relative to the vehicle and rotate through a circular view up high. In your case, the camera does a high-low loop through the body of the vehicle!

I’m afraid I don’t know how you get the vehicle axis to act as the cameras axis of rotation, unfortunately. Presumably you can get the vehicle actor to broadcast its angle of rotation and use that in the camera actuator, or something. Even better, does one of the constraint modifiers help you out?

Good luck!

edna was right, took me 3 minutes…
i hope it is what you want.
I just attached the Camera to an Empty and this Empty to the tank.

Attachments

Camera.blend (568 KB)

Ah, of course, you parent the empty to the tank and the camera to the empy. Then you can rotate the empty quite happily without it rotating the tank.

And there’s you having only just joined Blenderartists, sevi_. Good work!

edna, I wanted to initially observe and debug the movement of the camera, but I could not because it disappears when the game engine starts. Parenting a small visible object to it is a really good idea, though.

I understand now the relationship between the camera axis an the vehicle axis, I now also understand the difference between axis and axes. Thanks :stuck_out_tongue:

sevi, that was pure genius! I never imagined it would be that simple. Initially, I thought about writing 500+ lines of python code and making offerings to the Blender gods, but your method is much simpler and better. Thanks!