Launching weapons on flying vehicles
by Jeff Wilkinson · in Torque Game Engine · 12/19/2002 (4:54 am) · 4 replies
I am just trying to find a way to mount missles and bombs onto a flying vehicle so it shows the weapon but when I launch it the weapon fires off the rail and there is no missle or bomb there any more!


#2
Here we mount a single weapon.
%obj in this case will be the flyer.
%obj.mountImage(NameOfWeap, Slot); //0-8 on the slots
Now in the onFire of the Image we need to find out the vehicle we are flying. %obj here will normaly be the player/vehicle ( The object it is attached to ).
In order to remove the Image after we fire, call %obj.unMountImage(slot); // slot being the slot number of the image you mounted in onAdd.
You can add the image back the same way as the onAdd function if you wanted to add a reload/refuel option.
Hope this helps..
Sam
12/19/2002 (5:14 am)
Assuming you already have your image Datablock, lets look at the onAdd function and create the missiles/bombs there for starters.Here we mount a single weapon.
%obj in this case will be the flyer.
%obj.mountImage(NameOfWeap, Slot); //0-8 on the slots
Now in the onFire of the Image we need to find out the vehicle we are flying. %obj here will normaly be the player/vehicle ( The object it is attached to ).
In order to remove the Image after we fire, call %obj.unMountImage(slot); // slot being the slot number of the image you mounted in onAdd.
You can add the image back the same way as the onAdd function if you wanted to add a reload/refuel option.
Hope this helps..
Sam
#3
Like that the weapon is still there, if needed.
Hope it helps
12/19/2002 (6:57 am)
The other trick is to "hide" your weapon inside the flying vehicule.Like that the weapon is still there, if needed.
Hope it helps
#4
12/20/2002 (4:34 am)
Thanks this helps alot!
Torque Owner Anthony McCrary
1) Have the weapon fire a projectile.
2) In the onFire() function you would want to unmount the weapon image