Vehicle Impulses?
by Xavier "eXoDuS" Amado · in Torque Game Engine · 10/25/2003 (10:43 pm) · 5 replies
Has anyone been able to apply impulses to wheeled vehicles to simulate like a 'boost'. I've been trying different things for a while but can't get it to work. I tried scaling both getVelocity vector and getEyeVector, but both return weird values that include a z value, which I would have thought that wouldn't exist since the vehicle is still in a flat surface.
Thanks in advance.
Thanks in advance.
About the author
#2
$mvTriggerCount3++;
Then you have to set up the relevant datablocks variables, and voila, you have a boosting car :D
if you wanted them to move from some sort of explosion or something, then impulses are better, but I prefer this way for speed boosts, as you can define a new sound to play while boosting and energy drain in the datablocks and the engine does all the work for you.
10/26/2003 (5:02 am)
Or you could just use the in built boost stuff ;) Ie, set up a button to set $mvTriggerCount3++;
Then you have to set up the relevant datablocks variables, and voila, you have a boosting car :D
if you wanted them to move from some sort of explosion or something, then impulses are better, but I prefer this way for speed boosts, as you can define a new sound to play while boosting and energy drain in the datablocks and the engine does all the work for you.
#3
@Ralph: Thanks a lot. What's the dot product for though? :\
10/26/2003 (6:32 am)
@Dylan: yes that's true, and I was doing it that way before. But I'm still undecided how it will 'feel' better so I was trying the applyImpulse too.@Ralph: Thanks a lot. What's the dot product for though? :\
#4
10/26/2003 (10:15 am)
Sorry, I didn't post all the code, oops. The first two lines are part of a limit. If the object is traveling to fast I do a return. This is because I want to limit, or used for a safetly net because over a certain velocity the engine crashes. Full code:%vel = %obj.getVelocity();
%vec = vectorDot(%vel, vectorNormalize(%vel));
if(%vec > 75)
return;
%obj.applyImpulse(%obj.position, Vectorscale(Vectornormalize(%obj.getEyeVector()), %obj.getDataBlock().mass * 30));
#5
Thanks again, I was trying something very similar but It wasn't working, I'll try again and see what happens, maybe it was a typo or a wrong variable name or something.
10/26/2003 (10:22 am)
Ahhh that makes sense now :)Thanks again, I was trying something very similar but It wasn't working, I'll try again and see what happens, maybe it was a typo or a wrong variable name or something.
Zod
Change the 30 to suit your needs or divide instead of multiply.