Game Development Community

Jerky / Jumpy / Jittery movement along t2dPath - TGB 1.7.4

by Mark J A Smith · in Torque Game Builder · 05/16/2009 (4:08 pm) · 3 replies

Hi,

I've been working on a vertically-scrolling shmup, and have run into an issue - when I attach objects to t2dPath objects, and tell the object to move along the path, the object stutters/jitters/is jumpy. The movement along the path is not smooth, at all. This is the case for both bezier and catmull-rom paths. For linear paths, the movement is wonderfully smooth, with no jitters/jumpiness.

My question is: am I doing something wrong? The jumpy/jitter movement happens with objects of any speed at all, right from really slow (like 5), to really fast (100 or more). It's frustrating that it works properly and without any jitter when using a linear path...

I have in the past written my own bezier spline-based path system in C++, for an old game project, but I was hoping that the implementation included in TGB would save me the trouble of implementing it into the TGB Engine.

Has anyone gotten this to work properly, without jitters? I'm thinking it's something to do with not using a small enough value to interpolate between nodes on the path - I think this because when a path has a few nodes close together, the speed of movement of the object on the path is not even close to being consistent - I had this same issue with my own C++ implementation before I started interpolating over and around nodes, not just from node-to-node, if that makes sense?

I can post a simple example project/executable if anyone is interested in seeing the issue first-hand.

Also note that this happens in TGB 1.6 as well. I'm currently digging through the source for t2dPath.cc to find out what's going on.

Thanks!

PS: my apologies for putting this in this forum, and the public one - I haven't been here for awhile, and couldn't find the private forum at first...my bad!

#1
05/16/2009 (11:37 pm)
I know this problem and it really sucks.

I asked the same question some months ago on IRC and luckily somebody answered it. The solution is to put an extra t2dSceneObject between moving object and path. Here's what you need to do:

1. Create a path
2. Drag a Scene Object to the scene and mount it to the path
3. Drag a Static Sprite to the scene and mount it to the Scene Object
4. Set a Mount Force value for the Static Sprite under the Mounting rollout (a vlaue like 3 or 4 should work well with your shooter)
#2
05/22/2009 (1:56 pm)
This works great Stefan, thank you oh-so-very-much!!

I've been playing around with the mount force values to find something that still allows the object to move smoothly while following the path fairly closely (I've settled on 5-6 for most velocities). If you go too low with the mount force value (like 1 or 2), the object doesn't even come close to following the actual path, with the following being worse the more curvey/complex the path is.

Thanks again, now it's back to my shooter! I'm currently in the process of creating a set of behaviors to make it easier to add enemy shot patterns right in the level editor...I'm going to make them available to the community when they're done. :)
#3
05/22/2009 (2:53 pm)
i'll be waiting to see that. since i dont use paths in my past projects, i dont knwo what you¡re talkin about, but thanks for the info.