Mounting a Tank
by Stephen · in Torque Game Engine · 05/01/2006 (12:57 am) · 7 replies
I have added the tank and the TGE Vehicle Resource to my project. I can mount all the other vehicles besides the tank because the tank uses node 5 (I think or something like that). I have tried editing the vehicle resource to support the tank but I have had no luck. Could someone please give me a hand to get the tank working with the Vehicle resource.
Thankyou.
Thankyou.
#2
05/01/2006 (1:47 am)
The tank isn't a vehicle class, it's derived from the player class. The vehicle resource uses rays to cast for vehicles, not players, that's where your problem is. To remedy you'll probably want to look in the function Armor::onCollision in player.cs and make some modification to allow for tank mounting. I think by default, the code with the tank pack adds some code to that function to automatically mount tanks on contact, if you want mounting with a button (like vehicle resource) this is where you'll have to change stuff.
#3
05/01/2006 (9:06 pm)
Could you give me a example on how to do this?
#4
Now, I can mount all the vehicle fine including the tank. So I need help getting it to mount on node 5 just for the tank.
Thanks
05/03/2006 (9:12 am)
Okay, I have been searching and troubleshooting and I have got some success but I have another problem. I can now mount the tank but I can't mount on node 5, it mounts on node 0 and I'm stuck with that. Here's what I have done,In commands.cs @ function serverCmdMountVehicle(%client) %searchMasks = $TypeMasks::vehicleObjectType; Changed to: %searchMasks = -1; (To be able to mount anything, because I can't find what the Typemask is for the tank. Also I tried using TankShape and TankShapeData for the Typemask but it doesn't work. I have also tried %searchMasks = $TypeMasks::vehicleObjectType&&TankShape; but I get this error starter.fps/server/scripts/commands.cs (104): string always evaluates to 0.) %scanTarg = ContainerRayCast (%pos, %end, %searchMasks); Changed to: %scanTarg = ContainerRayCast (%pos, %end, %searchMasks, %client.player); (This to fix where it wont try mounting the player)
Now, I can mount all the vehicle fine including the tank. So I need help getting it to mount on node 5 just for the tank.
Thanks
#5
05/03/2006 (9:32 am)
Look in the tank pack version of player.cs, in there you'll find the code you need to mount to node 5 for the tank. From memory I believe it''s in the onCollision function.
#6
Thanks
05/09/2006 (9:11 pm)
I have tried everything to get it so you can mount the tank correctly. Still I have not had any luck getting it to work. Could someone please help me out? I think I know what the problem is but I don't know how to fix it. Here's the vehicle.cs, that I have edited so please go though it and see what's wrong. I think the problem is in the "function findEmptySeat" but I'm not sure.Thanks
#7
Thanks
05/11/2006 (5:47 pm)
Could someone please give me a hand to get the tank mounting correctly?Thanks
Torque Owner Paul /*Wedge*/ DElia