Camera Jitter

I am getting some camera jitter (back and forth slow general movement towards wanted direction) when changing the HPR values. It only happens when looking at the part of the scene with lots of objects that are changing their position.

Is there some type of smooth method that accounts for what I am guessing is latency related? I have tried different camera speeds to no avail.

Here’s an example of how I’m changing HPR values

in my class

self.viewup = 0

self.accept(“arrow_up”, self.lookUp, [1])
self.accept(“arrow_up-up”, self.lookUp, [0])

def lookUp(self, value):
self.viewup = value

inside class def that is called by task manager

if self.viewup:
self.angle += camspeed
base.camera.setP(self.angle)

Thanks

Look at this code from RR (part of the move task):

# Get the time elapsed since last frame. We need this
# for framerate-independent movement.
elapsed = globalClock.getDt()

# If the camera-left key is pressed, move camera left.
# If the camera-right key is pressed, move camera right.

base.camera.lookAt(self.ralph)
if (self.keyMap["cam-left"]!=0):
        base.camera.setX(base.camera, -(elapsed*20))
if (self.keyMap["cam-right"]!=0):
        base.camera.setX(base.camera, +(elapsed*20))

The idea is to move every thing not at frame rate speed but according to the time passed since the last frame was rendered.

This improves camera movement a bit, until I point camera totally vertical in the Z plane (that is, at the virtual sky). Even when I reduce the number of objects the camera gets pretty jittery when viewing the virtual sky, it gets especially jittery once I move the camera more than 90 degrees in this up “direction” as it pitches back towards the horizon.

Is your sky perhaps something expensive? Does it perhaps include a large number of geoms, or heavy shaders? Given that you apparently had the same symptoms when viewing a large number of moving objects, I suspect that they may share a common or similar cause.

With help, figured out that the camera and update functions were inside a class that had multiple instantiations. So, there were about 190 cameras all trying to update the hpr()…yep. thanks for the help :slight_smile: