Game Development Community

Different vehicle friction per terrain type

by Ronald J Nelson · in Torque Game Engine · 07/08/2007 (8:33 pm) · 3 replies

I have been working at this for a while now and have managed to make a material mapped variable read during the vehicle's travel over different terrains that reads the terrain information. However, when I try to use this variable to adjust the value of surfaceFriction I have alot of erractic shaking.

Since surfaceFriction = 1: initial I simply had a new value added to be surfaceFriction = 1 * frictionMod; which the value frictionMod is initialized at equalling 1.

Now I don't even have to change terrains to cause this effect. Has anyone tried to do this before and what did you do to make it successful?

#1
07/08/2007 (11:44 pm)
Ron, Sam Redfern has integrated a similar system in Darkwind: War On Wheels.
Unfortunately he is out for next 2 weeks. :p

We even have more variables attached to the terrain textures.
I'm only on the designing side, so I can't help that much.
I can only encourage you, because, yes it can work! :)
#2
07/25/2007 (2:28 am)
It sounds like you're taking the same route I did?

1. Add a 'friction' value to the terrain texture properties
2. Add a 'friction' value to the Surface struct definition in the Wheel struct definition in wheeledVehicle.h
3. Read the terrain friction in the 'extendWheels' function and attach it to each wheel (only for wheels whose raycasts hit the terrain object, of course)
4. Apply this friction value in the updateForces function, as a replacement for the hardcoded value of 1 that's already in there.

What range of friction values are you trying to use for your frictionMod?

When I hear erratic shaking, it makes me think there's some different calculation happening on the client and server, but that's unlikely in this case.


edit: when you just try a hardcoded value for surfaceFriction that's a value other than 1, do you still see the erratic shaking?
#3
07/25/2007 (8:00 pm)
Yeas but i was using static casts to get material map information from my objects. I still think this method will work but I may need to set up some sort of buffer.