Game Development Community

Mounted objects bugged in 1.5?

by Magnus Blikstad · in Torque Game Builder · 04/05/2007 (12:11 am) · 14 replies

Seem to have a bit of an issue with mounted objects, they don't seem to be "updated" fast enough. (some issue with the new "tick-based physics" maybe?).

Recorded a video rather than trying to explain the problem further; www.blikstad.com/space_pirates/TGB15_mounting_weirdness.wmv
(It doesn't quite look like that when fraps isn't running though, the "jumps" are much more rapid, makes it almost look like the mounted objects are just flashing for a fraction of a second).


I use code similar to this to do the mounting.
%wing.mount (%parent, %parent.WingOffset[1], 0, true, true, true, false);

#1
04/05/2007 (6:56 am)
This seem to sort of be done to collisions too... This is simply not good enough.
www.blikstad.com/space_pirates/bugged_tgb.jpg
#2
04/05/2007 (10:02 am)
Hey Magnus,
Try

$pref::T2D::disableSceneTick=1;

and let me know if that stops the jumping.

Cheers,
-Justin
#3
04/05/2007 (4:34 pm)
It does, but it instead makes the motion too "choppy". (like if no interpolation between ticks were done at all).
#4
04/05/2007 (5:05 pm)
Yeah, that pref turns off the interpolation, so you only move in spurts. Since you don't get the slipping of the mounted object, though, it indicates that the problem happens when interpolating (and not when ticking).
#5
04/05/2007 (5:10 pm)
I noticed something, if I change the updateSpatialConfig( false ); line in t2dSceneObject::updateMount to updateSpatialConfig( true ); the mount slipping goes away. (will this cause other "bad things"(tm) to happen?). It doesn't seem to fix the unsynced collisions though.
#6
04/05/2007 (5:19 pm)
I'm guessing that would have a major impact on performance because you'd now be updating mounted objects whenever you updated the parent (and then you'd update them again when the child updated). Probably wouldn't produce any other negative side effect though (but that's a guess).

One thing I notice when looking at the interpolate tick code is that it updates the mRenderTickPosition variable. Yet when it comes time in t2dSceneObject::interpolateTick to update the mount poistion, it simply calls the normal updateMount call, which simply updates the position (not render tick position). Given that, not surprising that mounted objects are slipping around. This is all done on a quick reading of the code (not even compiled on my machine at the moment) so please double check what I'm seeing.
#7
04/05/2007 (6:43 pm)
I think you may be right. But I'm not quite familiar enough (yet) with the code to have an absolute grip on what it does; Here's another interesting tidbit though. If I move the calculateMountNodes( renderTickPosition ); call in t2dSceneObject::interpolateTick to AFTER the processIsMountedRigid() if statement, it seem to work as expected.
#8
04/15/2007 (12:15 pm)
Has anyone come to a conclusion as to what the appropriate fix for this may be?

For what it's worth - when you mount something to a path if you use either of the two spline interpolation types the mounted object is *very* jittery and is rendered twice. It almost looks "ghosted". I went back to 1.1.3 just to make sure I wasn't seeing things and it worked just fine there.

I'd love to keep using 1.5 but broken paths is a bit of a show-stopper :)

Kudos on the behaviors functionality though - very nice.
#9
06/20/2007 (2:32 am)
I have the same problem with mounting camera to the player.

function playerShip::onLevelLoaded(%this, %scenegraph)
{
   $pShip = %this;
  
   sceneWindow2D.mount (%this, "0 0", 0);  
   %this.setLinearVelocityX(10);
  
}

If i use mount force something bigger than 0 its working fine, but I need mount force 0 for Wrap onWorldLimit. With mount force 0 is movement
Quote:... *very* jittery and is rendered twice. It almost looks "ghosted".
.

In 1.1.3 is everything working fine.
#10
06/20/2007 (1:38 pm)
@Magnus: There is an issue with non-rigid mounting that I'm looking at now. As far as I can test, rigid mounting works fine e.g. mount-force of "0". Note that I'm not talking about camera mounting here but scene-object to scene-object.

@Tomas: There was an issue with camera mounting but it got resolved. I'll run up a few tests shortly as per your example and see what happens.

- Melv.
#11
06/20/2007 (1:50 pm)
@Magnus: Forgot to mention that the only way I can reproduce what you get is by using quite a high mount-force rather than a rigid one. If you use a low force (non-rigid) the mounting is still incorrect but it is smoothed out by the low force applied to it.

- Melv.
#12
06/20/2007 (6:59 pm)
Melv; I was only using rigid mounts, but I believe this was fixed (or at least made slightly better) in the last version of the beta. I can't quite remember right now though and haven't had a chance to work on this any more lately.
#13
06/21/2007 (12:25 am)
No problem.

It is very strange because I cannot duplicate any problem with rigid mounts no matter what I do and that includes rolling-back the code to the appropriate beta code. I appreciate that you've not worked on this lately but if you do have any code that can duplicate the problem on your system then I'd appreciate it if you could fire it to me now or in the near future.

I'm currently looking at the non-rigid case as well as an odd problem with camera mounting as mentioned by Tomas above.

Thanks!

- Melv.
#14
06/21/2007 (1:36 am)
Don't have time to really dig in it at the moment. But I did a bit of checking at least, beta 3 fixed it. The way t2dSceneObject::interpolateTick looked in beta2 definitely didn't work.

Anything else that could be specific to my code? hmm....
Well... it IS pretty complicated and odd =)
Maybe it's because I'm doing multiple levels of mounting? My ships are basically an invisible t2dSceneObject (it's this object that does all the moving), to this object a cockpit (t2dStaticSprite) is mounted and then the wings are mounted to the cockpit. (and then you can mount further things to the wings, etc, etc).