Game Development Community

Wheeled Vehicle Update

by Tim Gift · in Torque Game Engine · 02/15/2002 (9:47 am) · 118 replies

Just moving this thread over from the news items as that was starting to get a little long.

I went ahead and changed the wheeled vehicle to use datablocks for both the tire and spring parameters. The datablocks are set dynamically for each wheel, so you can mix and match suspension and tires...

The tire datablocks also includes the tire shape, so the car body no longer includes the tires. Getting those to render correctly has been a pain in the butt, mainly because MilkShape mangles it's node transforms (and you can't edit them, etc. very annoying). This wasn't so much of a problem when the tires were in the shape, but now that I'm trying to attach them to the hubs, it's lame. Anyway, because I've been having trouble getting the node transforms in MilkShape oriented correctly, I decided to bag it and do all the animations in code. That means the new minimum requirements for a car body is that it contains the root position of the hubs, that's it.

I have it pretty much all working, but rendering the wheels as separate shapes, and the new datablocks has complicated the code a little. I'm going to take some time and do a little more cleanup and re-factoring before I check it all in.

On the animations... the suspension and steering animations are still there, and are still being run, but now have nothing to due with the physics at all, or the placement of the wheels. (You won't even need any animations to import a new car.) You will still be able to do suspension and turning animations though if you want, and the code will try to line them up. I'll put some suspension struts in the test car later and make sure that code is all working correctly :)

I'll post back on this thread when it's checked in... this will, of course, mean re-doing any current test shapes you have, but that's life on the edge :O
Page «Previous 1 2 3 4 5 6 Last »
#1
02/15/2002 (9:53 am)
So now we don't need ANY animations for the wheeled vehicle? sounds good to me. . . .will the wheels be seperate .dts file? also will the wheel contain the info on the body's height. . . ie switching low profile tires to moster truck tire will automatically recalibrate the body's location in 3d space.
#2
02/15/2002 (9:57 am)
The tires are seperate dts shapes, the diameter of the tire is determined from the z height of the tire shape (using it's bounding box). Changing tire datablocks on the vehicle will change it's height off the ground. You can put different size tires on the front and the back, etc.
#3
02/15/2002 (10:04 am)
Yayy! thats how I saw it. Thanks Tim. Just makes it simpler for us non-animated-modelling types :)) so I can now do my super buggy without animations!

Yep, definitely makes sense to seperate behaviour from model/animation code.

So i guess this means that we can do all manner of stupid vehicles now (with incredibly weird formations of wheels and tire sizes :))

Octabuggy anyone?

Phil.
#4
02/15/2002 (10:06 am)
Would It be possible To have Vehicles set up to trip triggers? Would be a useful way to set checkpoints for races.


Just an Idea.
#5
02/15/2002 (10:22 am)
Vehicles should definitely activate triggers. I'll look into it.

Phil... I thought you'd like that :) The earlier approach didn't bother me because I could manage a few animations in MS, but this node transform thing was the last straw. But now that I have this going, I think you were right, this is the way to go.
#6
02/15/2002 (10:23 am)
.. artists can still do the steering struts and suspension animations they could before though, just no longer required...
#7
02/15/2002 (10:25 am)
One last thing... the root position of the spring nodes is still defined in the shape, that's the last tie. I've left that so that there is some connection if the artist does want to animate suspension.
#8
02/15/2002 (10:39 am)
So is this in CVS head yet?

Schnapple
#9
02/15/2002 (10:45 am)
No it's not, I'll post when it goes in. Probably this evening.
#10
02/15/2002 (11:28 am)
weapons? make them fire weapons (if grampa gets in front of me i want to blow him out of the water/road) :)
#11
02/15/2002 (11:47 am)
So let me get this right, in the wheel file there should be a node called "hub" which will match up with the "hub#" nodes in the body file. This should align the wheel in place. But how does the supsension work, I was thinking that there should be a node representing where the suspention mesh ties to the body so the code could generate a line between each suspention node and coresponding hub# node, allowing the suspention mesh to be animated by the code, like the wheels are. I fear animating suspention seperatly might cause unrealistic effects? did any of that make sence?
#12
02/15/2002 (3:49 pm)
This might a rediculously stupid question regardling suspension, but here goes...

Can this be set up not only to detect the ground properly, but...let's say a huge force hits the left side of a wheeled vehicle. Can this code be used to show that side rocking up with the impact (right side down, obviously) then settling back to normal?
#13
02/15/2002 (3:54 pm)
Ok, checked in the latest...

Anthony.. there are no nodes in the wheel, the "hub" for the wheel is the origin of the tire shape. It's attached to the hub# node on the vehicle body.

The hub node on the vehicle represents the wheel in it's maximum up position, and is also used as the point to attach the springs. So if you have a non-animated hub, it just grabs that node position and the wheel goes down from there based on the defined spring length. The example ms3d car is now setup like this.

If you want to animate the suspension, the simplest thing is to create the art in this up position, then simply animate the suspension going straight down for some distance. You'd want to animated far enough to accomodate any spring length set in the datablock. You must animate the hub node going down. By looking at how far down the hub node is animated, I can figure out how to play the animation so that it matches what the suspension is doing.

If you're animating steering you'd tack it on top of this, steering right to left. About 45 degrees both ways. In this case the node itself doesn't need to turn. It doesn't matter if it does though (which it probably will if your setting this up correctly).
#14
02/15/2002 (5:40 pm)
Tim, great work :) it just keeps getting better and better heh...
Btw, i noticed 1 simple bug... havent checked the latest cvs head yet but i dont think its fixed, dunno...
but when you apply brakes, the wheels keep turning like normal but it starts slowing down... actually if you apply brakes on a car it will stop the wheels from spinning but the car would slide on the terrain.. depends on how hard you press the pedal tho...
On another side, tried pressing the brakes on the air? =)
It looks even weirder the wheels just keep turning without any slowdown, since its in the air it doesnt seem to apply any brakes....
#15
02/15/2002 (5:51 pm)
You can set how much brake force you want to apply in the datablock. If you set it too high though, the wheels just lock up. I toned it down a little for a little more smother braking. Ideally it would be set depending on how hard you press the space key :)

No forces get applied at any wheels that aren't in contact with the ground. I do need to fix that.
#16
02/15/2002 (5:58 pm)
Much better improvement you can do some nice jumping now w/o flipping!!!! looking great
#17
02/15/2002 (8:06 pm)
You mentioned that ideally that it would depend on how hard you press the space bar, that begs the question, does torque support joysticks? I've got a wheel here and I'd love to test it out with the gas and brake pedals :D
#18
02/16/2002 (4:32 am)
This really seems to be coming along!

I'm going to download the head version whenever Tim shouts out that this newer version of the racing mod is up :)

Sounds like fun, and a rough way to see how vehicles will be working. Now maybe we can finally drive this humvee model we've had sitting around for a month :)
#19
02/16/2002 (7:00 am)
Sounds great Tim! This is wonderful stuff. :) I had a question, will the axles need to be animated too? Or is that handled in code as well? (Haven't seen the latest yet). So when the wheels bounce along, the axle will pivot upward or downward to match the hub position. This way the axle isn't sitting at the base of the tire when the hub is in the full upward position. Here's a quick visual (not a very accurate depiction, sorry):

[]/[]
[]-[]
[]\[]

Just curious how we should approach this. I was thinking it would be the animation way, but needed your input. Thanks for any info. :)
#20
02/16/2002 (10:46 am)
Fixed the braking in air thing... all the latest changes are in cvs... The next thing on my list is look at have the vehicles activate triggers, so we can build lap counters, etc.

The engine does support joysticks, but the vehicle code currently uses a trigger (on/off) for the brakes, it wouldn't be hard to change though.

Tyler, the vehicle is currently four wheel independent suspension. Anything attached to the wheels, suspension, structs, or an axle, would have to be animated with the "spring#" sequence. Though it won't behave like it has a fixed axle, you could probably animate it that way by making the spring sequences blends.
Page «Previous 1 2 3 4 5 6 Last »