Game Development Community

TGB 1.7.x: Camera jitters about every second

by Michael K. · in Torque Game Builder · 10/26/2009 (11:09 am) · 6 replies

I know this has been reported a couple of times, but couldn't find a solution.

Here's what's happening: I mount my camera to an object and move the object (with setLinearVelocity). As soons as my object starts to move the camera jitters slightly about every second (i do have high framerates).

Has anyone found a solution for this problem? It is very annoying.
I am using the current version of tgb (1.7.4).

Thanks alot!

#1
10/26/2009 (12:06 pm)
What parameters are you using for the mount?
#2
10/26/2009 (12:28 pm)
I'm actually just calling SceneWindow2D.mount(%TheObjectItIsMountedTo);
#3
10/26/2009 (12:40 pm)
Hey Michael,

From what I understand, this a rounding issue. Essentially, the mounted camera is trying to position itself in between screen space pixels because of the interpolation done when %TheObjectItIsMountedTo is being moved.

Try specifying/playing with elasticity parameter in your mount function call:
sceneWindow2D.mount(%TheObjectItIsMountedTo,0,0,0.1,false);

If memory serves, the parameter list is:
object, xoffset, yoffset, elasticity, trackRotation;
#4
10/26/2009 (1:01 pm)
Thank you Patrick. I played around with the parameters, but anything above an elasticity value of 0 gave me unwanted results (and didn't fix the issue).

I fear it is some kind of a problem with mount. I noticed that if i mount an object onto a mounted object in the tgb editor then it ignores a mount force of 0. BUT if i mount it in script, then it works (with melv's fix).
#5
10/26/2009 (2:11 pm)
I think your fears are correct - chalk up another to hopefully fixed in T2d I guess. However, here is an implementation that I've used that does not jitter, perhaps it's the object type that is making a difference?

function t2dSceneObject::mountCamera(%this)
{	
   sceneWindow2D.mount(%this, "0 0", 0, false);
}
then call in your onLevelLoaded function for you player using:
%this.mountCamera();
Note: I used an elasticity value in mine but you say that you still had jitter with that, so perhaps this will work.

I wish I could be more help.
#6
10/26/2009 (2:49 pm)
You should just use the mount camera to object behavior in the TDN, it dosn't have jitters and you can set a lot more things.