[camera] vibration of 1st person camera system

Hi,
i have strange probleme with base.camera:
whenever i change the z coordinate, or use the lookat method, it vibrates :frowning:

Solution 1: search the forums, I’m pretty sure I’ve seen variants on this problem about 3 times since I joined less than a month ago.
Solution 2: disable Panda’s default mouse controls and any other system that might be sending conflicting position/orientation data to the camera.

What key workds should i look for?

i have already call base.disableMouse()

i noticed that this vibration ovvurs only when the z coordinate changes

Are you setting Z repeatedly, or just once, and is the vibration constant when/after you set the Z coordinate, or does it jump once and then sit at an identifiable position until you touch it again?

it’s the panda’s physics engine who moves my player.
you can test the program here, the suspected files are camera.py and world.py

Edit: arrow key to move, space to jump.

I don’t generally grab whole packages since I’m (a) at work and (b) behind a firewall, but if you’re using Panda physics that probably has something to do with it. Panda physics likely has its own background tasks which update everything under its control, and anything you do will be fighting that. If your camera is parented to your character, it’s probably either fighting your manual commands or just moving as the physics constantly iterates on gravity vs collision. If the camera is separate but looking at your character constantly, your character may be subtly jittering, again because of gravity and the inherent imprecision of floating point and collision detection/compensation.

Reparent the camera to the player node. We discussed that on the IRC channel before you joined, it solves problems. You might have to adjust some values then.

my camera is not directly apparented to the player.
since you can’t download the package, this is the camera.py:

so what’s the solution for that? :laughing:
since you can’t download the package, this is the camera.py

@Bradamante, see you in irc!
thanks, this solved the problem

well, offhand, you have a bunch of stuff on the order of

camvec = self.player.getPos() - base.camera.getPos()

If your camera is parented to your player, you should never be comparing the position of the two directly since they’ll be returning values in different coordinate spaces. One major tenet of parenting is that the child always returns position/rotation relative to its parent, so your camera would be returning its position relative to the player by default, while I assume your player returns relative to render. You can get around this if you really need to by passing the node to use as a coordinate space into both getPs calls.

i wasn’t reparenting the camera to the player.