Game Development Community

How does the car.cs build the buggy properly?

by Smelly McBeard · in Torque 3D Professional · 07/07/2009 (8:39 am) · 30 replies

Hello again guys and gals,

I have a couple questions about the Car.cs file and the buggy inside the T3D engine. Since there is no .cs file other than Car.cs that tells the engine how to build the car (as far as I can tell with my programming knowledge which isn't a lot) I can't understand how the engine is able to determine where to put the tires, how to make the springs work and etc. using a COLLADA file. I understand there is a tutorial for the .dts version of the buggy but I am looking for a way to build a vehicle using a COLLADA file. If anyone could give me a direction to find a tutorial of that sort, or could just give me some information on how to setup a COLLADA file to be used as a vehicle that would be great.

I currently have the COLLADA file with the base of my vehicle in the engine similar to the buggy.dts file that came with the beta. However when I try to add wheels to my vehicle it fails. Thanks for the help folks.

"The Crayfish"
Page«First 1 2 Next»
#21
07/17/2009 (3:12 pm)
Quote:WheeledVehicle models need a node called 'hubX' to indicate where to place each wheel. For example, a four wheeled vehicle would have nodes: hub0, hub1, hub2, hub3. If these are missing, the engine will crash.

In what locations? I mean clockwise or counter clock wise starting from what position? I think that this is gonna have a bearing on weather the front or rear wheels are going to turn no?
#22
07/21/2009 (12:09 pm)
Hey guys me again! Tell the GG team awesome job on BETA 4, but I got a couple questions for you, like what files do I need to port from the fps Genre Kit into a new project to have the assault buggy work properly. Right now every time I click to fire the weapon I crash. Also, the way the assaultbuggy.cs file is built is that it's actually using the car.cs file am I correct? So...if I want to make a vehicle with weapons do I have to have two separate .cs files or can I just have 1 and that is my "assault vehicle" instead of just car.cs. Alright thanks for all your help so far and awesome job guys!

STARE AT MY BEARD.
#23
07/21/2009 (3:23 pm)
You will need the WheeledVehicleData namespace methods located in "game/scripts/server/car.cs".

You will only need the TireEmitter and TireParticle datablocks contained in "game/art/datablocks/car.cs", nothing else pertaining to the DefaultCar is necessary.

At the time that beta4 was being put together I hadn't really optimized that assaultbuggy script so it also shares the altProjectile from the steam pistol and it's associated particles and emitters. I still need to make it unique so it can be used as a stand alone script.

However, I'm also working on a vehicle management system for the FPS kit that may simplify adding a vehicle... or it may not. But if it works right all you would need to add new vehicles would be a set of datablocks with no further scripting necessary.
#24
07/21/2009 (4:21 pm)
Quote:In what locations? I mean clockwise or counter clock wise starting from what position?

Completely up to you. The WheeledVehicle 'setWheelSteering' and 'setWheelPowered' methods take a hub index as a parameter. If you want to be use the default car.cs:

0: LeftFront
1: RightFront
2: RightRear
3: LeftRear
#25
07/22/2009 (2:23 am)
Just remembered.... but these functions aren't needed at all:
  • None of the BuggyBlasterImage::onMount() or onUnMount functions -- those where just leftover from another experiment.
  • function AssaultBuggy::onTrigger()
  • function fireNextGun()
  • These last two were a "trick to make the left/right weapon fire in alternating sequence. I've since done away with them. I had forgotten that the newly added alt-fire mode could actually trigger a 2nd weaponImage if one was mounted. So that means left/right clicks of the mouse will fire the relevant weapon.
    #26
    07/23/2009 (11:17 am)
    Hey guys,

    I got my weapon mounted to my vehicle, I decided to try to do one that wasn't the pistols so I went with the "SwarmGun" rocket launcher and got that mounted to my vehicle and it fires fine, when stationary. As soon as I move I can no longer see the rocket, the smoke trail, or the explosion unless my vehicle is pointing somewhere toward the sky then I can see it. However that only works if i'm in 3rd person view, if i'm in first person view I can't see anything involving the rocket or it firing. In third person I know that the rocket is firing I just can't see the projectile or particles because it still discharges the shell casing. Any help would be great I can't figure this out at all. It's like my weapon projectile and particles are only set to render if they are stationary or in 3rd person view. Thanks.
    #27
    07/23/2009 (11:30 am)
    You may have to tweak the offset to make the weapon more visible. It may be sitting low and/or pointed at the ground also. When I first setup the AssualtBuggy the pistol ended up the player's feet and barely shot out in front of the tires. Trial and error is how I eventually got them positioned.

    It's also possible that when you're moving that the projectile is colliding with your vehicle... do you hear any explosion/firing sounds?
    #28
    07/23/2009 (2:40 pm)
    I haven't listened to it yet but I will. I got the weapon to fire when stationary in 1st and 3rd person now. But while moving it still won't how did you get it to work did you offset something to fire in front of the vehicle? Also, How do I get a camera to follow the movement of a weapon...lets say a turret on a vehicle instead of following the vehicle? I want to have my vehicle drive on a path and the user control a turret on the vehicle similar to the warthog in the halo games where there is a turret on the back controlled by a character and the vehicle is controlled by a seperate driver. Any help would be awesome. Thanks for all the help so far.
    #29
    07/23/2009 (2:52 pm)
    The only offset I used was the positioning of the weaponImage itself. I placed the SteamPistols about where the sideview mirrors would be on a car. And projectiles are fired normally... well... with a little bit of projectile spread so that the shots kind of scatter instead of fire straight ahead.

    For controllable turrets on a vehicle, hmm... that can get tricky. There is a turret resource that can be used with a little bit of coding to mount turrets to a vehicle. I only ever used it for stationary gun emplacements and never got around to attaching one to a vehicle. But I do remember that the Combat Starter Kit used the same resource.

    #30
    07/23/2009 (2:54 pm)
    And here is the updated turret resource ready for use in TGEa 1.8.1 which is a bit closer to Torque 3D than the original resource.
    Page«First 1 2 Next»