Game Development Community

Vehicles as projectiles

by Bullitt Sesariza · in Torque Game Engine · 11/21/2007 (8:37 pm) · 3 replies

Hi, like the title suggested, can I make vehicles as projectiles? I mean I need a vehicle that start at some position and end at somewhere else and can collide with the player and respawn it again at the starting point, etc. In some way it has a projectile's property, but it needs the animation of a vehicle (the wheel, etc).

Thanks in advance.

#1
11/21/2007 (9:15 pm)
The vehicles are affected by gravity so if you create one and give it a starting velocity that tosses it into the air, it will fly like you had set the ballistic property of a projectile. (Note that the gravity acceleration the physics uses is higher than usual Earth gravity. See vehicle.cc. Cars don't use the gravityMod field without a code fix so you would have to change the source to adjust this.) You can script actions on collisions normally.

Starting the vehicle off with a particular velocity might be harder. You need to look through the vehicle and its base classes for script functions you can use. You could either write a setVelocity type consolemethod, or perhaps use the existing setImpulse

void Vehicle::setVelocity(const VectorF& vel)
{
   mRigid.linMomentum = vel;
   setMaskBits(PositionMask);
}

(This works by overriding the empty shapebase baseclass method called by the ConsoleMethod( ShapeBase, setVelocity )

engine\game\shapeBase.cc(3950):ConsoleMethod( ShapeBase, applyImpulse, bool, 4, 4, "(Point3F Pos, VectorF vel)")
#2
11/25/2007 (7:19 pm)
@Matthew

Thanks, but not exactly what I'm looking for. Actually, this thread is pointless, really. It's just a flaw on my logic. Consided this thread closed. Heh, I'm so ashamed right now. :D
#3
11/26/2007 (7:51 am)
Rats, I wanted to see the flying frog cars ;)