Game Development Community

Jumpy Movement

by Matt Bates · in Torque Game Builder · 07/31/2006 (5:03 am) · 7 replies

I'm having some trouble getting smooth movement out of my object.
So I have an object (a rectangle) and a level (a tilemap with a single flat surface to move along).

I have an acceleration value which add/subtract to and then multiply the max velocity by the acceleration value.

When the object moves along the surface it moves in a "jumpy" fashion rather than smoothly.

I can't find why it doesnt want to move along smoothly, I've tried to just use a constant speed, not applying any downward constant force.

I'm updating the movement based on a timer and have tried using OnUpdateScene callback as well.

Any ideas at all would be really welcome.
Thanks

#1
07/31/2006 (5:51 am)
Are you updating your movement within the "onUpdateScene" callback? If so, that could be your problem. onUpdateScene is based on FPS and so is not constant. Also, what are your collision detections/responses for the ground and the object?
#2
07/31/2006 (6:04 am)
I've tried using a timer with the "ontimer" callback for movement updating but I get the same problems. I'm using clamped poly collision detection with the "oncollision" callback and am turning off the constant force (gravity) when the rectangle object collides with the ground.

I think the prolem is how I'm updating the movement, I borrowed the OnTimer method from the physcar example on tdn which shows no stuttering.

OnTimer was the only way I could think of updating movement without apply constant gravitational force all the time. I was calling the update movement function each time a key was pressed or released but I found if you "run" of the edge of a surface and continue holding down the direction key gravity would not apply itself since the check collide surface function would not be called.

Maybe a re-structuring of the function calls might do it.

*edit*
After switching to rigid response I no longer experience stuttering.....odd, argh I can't use rigid anyway it's not the response I want.
#3
07/31/2006 (6:27 am)
Have you changed any of the density/mass settings? Try enabling collision and physics for the ground and the floor and see if that works. For my movement, I use the example found in the shooter tutorial and I haven't encountered any problems. If you have the PRO version, you could take a look at this which fixes an issue with clamp collision, but I'm not sure if it'll fix this problem.
#4
07/31/2006 (6:40 am)
That clamp fix looks like the thing I'm after, I won't be able to try that out until tomorrow however which sucks. Good job I got the EA release yahoo!
#5
07/31/2006 (3:52 pm)
Try setting CollisionMaxIterations slightly higher on the obhect (say, 2 or 3). That should solve a lot of the jumpy-ness you see.
#6
08/01/2006 (4:13 am)
CollisionMaxIterations did the trick, hopefully in the new version I can set it back to 1 and get some performance back.
#7
08/01/2006 (2:46 pm)
You shouldn't be seeing a noticeable performance hit just from increasing collisionMaxIterations on a couple objects.