Game Development Community

Torque3D FlyingVehicle

by Andrew Edmonds · in Torque 3D Professional · 09/30/2010 (10:53 am) · 12 replies

Hi all,

Is anybody using a FlyingVehicle in Torque3D? I haven't used one at all since TGE 1.5 but I just dropped my old WarSparrow into a T3D level and I'm not getting any movement. I can mount it and set the control object but I'm not getting any movement.

I suspect it's partly to do with the rewritten collision scripts from my Stryker IAV. I was just wondering if anyone has any stock FlyingVehicle scripts they'd be willing to share so I can test..

Thanks

Andy

About the author

Formed in 2005, EiKON Games is an indie games development project based in the UK working on the tactical first person shooter "Epoch: Incursion". See the Join Us or Contact Us pages at http://www.eikon-games.com/


#1
09/30/2010 (11:52 am)
Yes, they worked in TGEA and are working in T3D - I don't have any scripts as my version of Vehicle/FlyingVehicle are highly modified
#2
09/30/2010 (12:00 pm)
Ok, thanks Matt. I suspected they were working which is why I didn't file it as a bug report. Now to track down why it refuses to move!
#3
09/30/2010 (4:05 pm)
Hey Andy, I recently fixed this in my own build. Essentially the problem is simply a missing call when it goes to integrate forces. Lemme find it and I'll post the solution here in a minute. It's actually broken in stock T3D so you might edit your post title for FlyingVehicle class not moving /w FIX or something.

Edit:
In FlyingVehicle::updateForces() right after
mRigid.force = force;
mRigid.torque = torque;

add these lines
// Integrate and update velocity
   mRigid.linMomentum += mRigid.force * dt;
   mRigid.angMomentum += mRigid.torque * dt;
   mRigid.updateVelocity();

   // Since we've already done all the work, just need to clear this out.
   mRigid.force.set(0, 0, 0);
   mRigid.torque.set(0, 0, 0);

   // If we're still atRest, make sure we're not accumulating anything
   if (mRigid.atRest)
      mRigid.setAtRest();

and presto! Your FlyingVehicle is fixed.
#4
09/30/2010 (4:08 pm)
Hi Ross,

I've been playing around a bit more this afternoon. Bizarrely the problem seems to be with the WarSparrow model itself. I substituted it with a simple box and I was up, up and away!

I can't explain what's wrong with the other model though...
#5
09/30/2010 (4:15 pm)
That's really odd. I fixed the problem via the code above (I edited my post) so it seems weird that it would be a problem with the model. Try your previous model and my code fix and see what happens.
#6
09/30/2010 (4:17 pm)
Will do - thanks!
#7
09/30/2010 (4:21 pm)
Oh, now very odd things are happening. I just put that model back in before making your change and it's flying again!

Don't you just love it when something like that happens??
#8
09/30/2010 (5:05 pm)
Hm, odd. It may be that a fix was made in the Vehicle class to address this, but I dunno. I know in beta 2 it didn't work at all with any model until I made that fix.
#9
09/30/2010 (6:23 pm)
I've been using FlyingVehicles rather regularly with a beta2 project, as well as testing at various times from the repo, and had experienced this also -- but it only appeared to happen at random. Somehow or another the problem went away after all I had done was add/remove a few vehicle datablocks and/or shapes... but never attempted to figure out why.
#10
09/30/2010 (6:26 pm)
Yeah that's exactly what I found. Oh well - all working now!
#11
09/30/2010 (8:44 pm)
I'm going to investigate this a little more and make sure my changes aren't causing it to just integrate twice, but I don't think that's the case. If you look in the WheeledVehicle class you'll see it does the same thing as my change at the end of updateForces.
#12
09/30/2010 (9:49 pm)
I'll try and replicate the previous weirdness I had sometime this weekend and also test out Ross' bit of code, which does seem like a good fix in theory.