padlock camera problem with 1.6.1

I am seeing a very noticeable jitter when i activate a camera padlock mode on an object. The padlock is implemented using a call to base.camera.lookAt(object) after calling taskMgr.step() in a loop.

The code runs smoothly on 1.5.3 and 1.5.4, jerks on 1.6.1.

Further investigation revealed the issue is with frame rate limiting.

I had the following lines in Config.prc to limit the frame rate to 30 fps:

Cap the frame rate.

clock-mode limited
clock-frame-rate 30

Replacing this with the following code fixes the jitter:

globalClock.setMode(ClockObject.MLimited);
globalClock.setFrameRate(30);

I too had a similar issue and was able to resolve it with your fix, thank you!

However, I wonder if there is another way to fix the jitter without having to limit the fps.

Lots of things can cause jitter, and it’s particularly obvious when it’s the camera. Limiting the frame rate only reduces the severity of the problem. The real solution is to ensure that your camera position is being properly computed with frame-rate-independent computations. Depending on your code’s logic, it may also be necessary to put the camera-update task immediately before the igloop task, e.g. by giving the task a sort value of 49.

David

I understand what you mean. However, I am fairly new at Panda and I am not sure on how to implement it.

I’ve seen this framerate independent movement used in the Roaming Ralph example; however, I wonder if it is possible to implement this when using Intervals?

Cheers!

Hi David,

The point of my posting wasn’t that frame rate limiting fixed my camera jitter problem. The root cause of the jitter was the script in the config file. Removing that fixed the jitter.