Making a tank work with a turret
by Andy Hawkins · in Torque Game Engine · 01/12/2008 (12:36 am) · 15 replies
So I have my Matrix Blaster Tank Program ready.
How do I do the following?
1) Mount the turret to the tank.
2) Make the tank glide without wheels.
3) Control the turret so I can turn it and fire - as a weapon I guess???
I don't need visible wheels right? I assume I am supposed to make the turret a weapon, make the tank chassis a vehicle without wheels, provide a mount point to attach the weapon (turret) and tweak the datablock until it glides, but I'm just speculating.

How do I do the following?
1) Mount the turret to the tank.
2) Make the tank glide without wheels.
3) Control the turret so I can turn it and fire - as a weapon I guess???
I don't need visible wheels right? I assume I am supposed to make the turret a weapon, make the tank chassis a vehicle without wheels, provide a mount point to attach the weapon (turret) and tweak the datablock until it glides, but I'm just speculating.

#2
01/12/2008 (6:35 am)
Yah, as a suggestion there is a tankpack. Its includes code for multiple tanks, tank specific turrets, as well as a sample abrams and sherman tank with a trinary side sponson weapon code. You can try lookint at the turret code and mount it manually, but if you are unfamiliar with code itmight be a bit complicated.
#4
Is a turret on a tank the same thing?
Isn't the problem to get a turret to turn face the target on yaw only? Elevation is a separate solution. Seems like something that can just be done with script.
Also don't I want to make the turret a weapon that is mounted as if you are holding it, and pitch and roll are ignored?
Just checking, you know. I don't want to have to mod the code for a simple solution.
01/12/2008 (3:27 pm)
Hmm... maybe I'm missing something but this link leads to source code to modify the engine to make turrets that point at targets automagically. Is a turret on a tank the same thing?
Isn't the problem to get a turret to turn face the target on yaw only? Elevation is a separate solution. Seems like something that can just be done with script.
Also don't I want to make the turret a weapon that is mounted as if you are holding it, and pitch and roll are ignored?
Just checking, you know. I don't want to have to mod the code for a simple solution.
#5
01/12/2008 (9:05 pm)
The tank code, that is in available is relatively painless, Plus it gives you lots of options. to mention a few, the ability to turn the turret and retain movement, the ability to easily swap out different turret weapons and such with a nice tankdb and weapon setup. as for as pitch and roll being ignored.. im not sure what your trying to look for, but if you just export without the up and down node in the model ( i think its called codeweapon) where its mounted and is moved up and down from.and you essentially get a stiff cannon barrel. but the Turret 1.2 code should also work, particualr if you want it to drive more like a hover car then a true tank setup.
#6
However, when I run the game, I made a copy of starter.fps, and then copied the fps files into that. I start the game, go to mission editor and there are no turrets in the Shapes list. I can't see anywhere in code where they have been assigned as shapes either.
So I can only find turrets under Static Shapes->fps->data->shapes->turrets. This tells me, the turret objects have not been registered as Shapes.
Any advice on how to finalise this Turret resource would be appreciated.
01/19/2008 (6:29 pm)
Well I wouldn't say it was painless, but I got it to compile. The resource is pretty hacked and has code in the sample files that isn't required. But anyway - it now compiles.However, when I run the game, I made a copy of starter.fps, and then copied the fps files into that. I start the game, go to mission editor and there are no turrets in the Shapes list. I can't see anywhere in code where they have been assigned as shapes either.
So I can only find turrets under Static Shapes->fps->data->shapes->turrets. This tells me, the turret objects have not been registered as Shapes.
Any advice on how to finalise this Turret resource would be appreciated.
#7
The aiturret tracks me but spawns this error (and doesn't shoot)
and I can't mount the turret, but I will investigate more.
I still need to mount a turret to my vehicle so that is another adventure for later today :)
It seems like there's no bounding box, or way to collide with the turret to registered the Armor::onCollision with the player.
01/19/2008 (7:06 pm)
Ahh... stupid brain - I blindly copied the contents of the fps folder from the turret resource, and it used some dso to get limited functionality. When I deleted dso's I realised that player.cs, shapebase.cs and game.cs from the resource are only the required changes and so it didn't work. I merged the changes and now it seems to work to a certain degree.The aiturret tracks me but spawns this error (and doesn't shoot)
turrets/server/scripts/shapeBase.cs (89): Register object failed for object (null) of class Projectile.
and I can't mount the turret, but I will investigate more.
I still need to mount a turret to my vehicle so that is another adventure for later today :)
It seems like there's no bounding box, or way to collide with the turret to registered the Armor::onCollision with the player.
#8
01/24/2008 (4:24 am)
Well I got my tank in. Something the tanks don't do in Tron but I made 'em do, is tilt the barrel up. The textuing is awful here but here is my AiTurret tank trying to shoot me. Next step is to put in into my mesa maze.
#9
01/24/2008 (8:01 am)
Nice job - I haven't yet got a tank to use with this resource :PQuote:I seems like there's no bounding box, or way to collide with the turret to registered the Armor::onCollision with the player.If you're using the standard resource, the turret weapon is mounted to the turret as a ShapeBaseImage. If that's the case in your setup, that's the reason - images don't do collision.
#10
01/24/2008 (2:11 pm)
Well I'm the person for the job! I'll make a couple of simple tanks like a Sherman and Rommel for people to play tank wars with. They won't be awesome authentic representations or anything, but enough for people to use this resource and as placeholders. Of course I have to mount them to a vehicle first - this tank is just as you say, a ShapeBaseImage (scratches head 'whatever that means')
#11
01/25/2008 (8:10 am)
I modelled an M1A1 Abrahms in about an hour - nothing special but a good placeholder tank to develop a game with. I've added the nodes to work with the turret resource. Next I will create the chassis as a vehicle and mount the turret to it.
#12
01/25/2008 (8:33 am)
Just FYI the tank pack for 20 bucks uncludes a abrams/sherman as well as code for a secondary and trinary (side sponsons) weapons Its worth checking out. That tank looks awesome though.
#13
I'd love to know how they got all the wheels detecting the terrain individually and distorting the treads - very impressive.
01/25/2008 (8:38 am)
Yeah I just looked at the Bravetree tank pack - it's $39.95. I'm giving mine away for free to help with the turret resource. It might make for a nice tutorial on how to make a compelling multiplayer tank battle too.I'd love to know how they got all the wheels detecting the terrain individually and distorting the treads - very impressive.
#14
01/28/2008 (8:58 am)
Andy, you would be my hero ;). For an hour's work, that tank's looking amazing.Quote:I'd love to know how they got all the wheels detecting the terrain individually and distorting the treads - very impressive.I'm trying to think how do to that for my own game :P. Not easy. Maybe simply animation - have the vehicle drive as if its treads were completely static, then for each wheel, have an animation of the tread going up or down. Then as you drive, cast a ray down to get the distance to the terrain and play the up/down animation to get the proper tread shape.
Quote:Of course I have to mount them to a vehicle first - this tank is just as you say, a ShapeBaseImage (scratches head 'whatever that means')ShapeBaseImage is a class used for things like weapons - they don't really exists as 'objects' per se, only when they're mounted to a player, vehicle, whatever. They don't collide or anything like that - they just look pretty and handle things like animation and particle effects.
#15
It's coming along nicely. I don't get how the player is able to mount/use a turret as explained is possible in the resource because it seems impossible to mount/use a ShapeBaseImage in this way.
Anyway - doesn't matter because I'm going to mount the barrel and turret to the tank. Oh yeah I've got the tank as a vehicle now, so a few more tweaks and I'll have the tank and turret working together.
After that I'll get the projectile working again (it was broken in the resource) and then post the tank.
01/28/2008 (2:30 pm)
@Daniel - I can see how that would work - but how does it deform the tracks? Maybe they are a blend sequence...It's coming along nicely. I don't get how the player is able to mount/use a turret as explained is possible in the resource because it seems impossible to mount/use a ShapeBaseImage in this way.
Anyway - doesn't matter because I'm going to mount the barrel and turret to the tank. Oh yeah I've got the tank as a vehicle now, so a few more tweaks and I'll have the tank and turret working together.
After that I'll get the projectile working again (it was broken in the resource) and then post the tank.
Torque Owner Rex
BrokeAss Games