Game Development Community

WheeledVehicle bug fix

by Daniel "Yogi" Mira · in Torque Game Engine · 07/19/2005 (3:37 am) · 7 replies

Hi

In wheeledVehicle.cc line 846 - 848 is:
F32 mu = surfaceFriction * (wheel->slipping) ?
            wheel->tire->kineticFriction:
            wheel->tire->staticFriction;
Only kineticFriction is in use in this case.
So I think it should be:
F32 mu = surfaceFriction * (wheel->slipping ?
            wheel->tire->kineticFriction:
            wheel->tire->staticFriction);

#1
07/22/2005 (2:43 pm)
Daniel,

I guess I am missing something.

The code you provide is the same.

-----------
nevermind.
I wasn't looking for the ) change.
#2
08/08/2005 (3:52 am)
Almost the same.
If You put closing bracket after wheel->slipping like example 1 then it will be same as:
F32 mu = (surfaceFriction * wheel->slipping) ? wheel->tire->kineticFriction: wheel->tire->staticFriction;
its because of operations priority.
But when closing bracket is at the end like in example 2 everything is as should be because surfaceFriction is multiplied by result of operation in the brackets.
#3
08/08/2005 (8:27 am)
Daniel,

Just curious. How does your change affect vehicle performance or traction. I'm a horrible coder and I can't figure out what your change does. However, I have noticed that my own wheeled vehicles skid and slide around on the terrain a lot more than I want them to. I'm hoping your code can fix that for me, but again, I'm kind of clueless about this stuff.

Thanks,

Aaron E.
#4
08/08/2005 (3:49 pm)
Good spot, Daniel. I'll review this one. #252.
#5
08/08/2005 (7:30 pm)
Yay, it's a good one. Fixed! Thanks!
#6
08/08/2005 (10:07 pm)
Aaron,

In original You will have value of wheel->tire->kineticFriction or wheel->t
ire->staticFriction. But it should be surfaceFriction * wheel->tire->kineticFriction or surfaceFriction * wheel->tire->staticFriction.
surfaceFriction is set to 1, but I did an upgrade and have made surfaceFriction configurable from the script, so every dif object can have its own friction value. And in this case it maters a lot if the surfaceFriction is multiplied or not. Besides in example 1 everything depends only on wheel->slipping if it's 0 or not so surfaceFriction wouldn't have any meaning.
That doesn't fix slipping problem directly but it helps a lot. Try change friction values and perhaps values of other car parameters in car.cs. I haven't found correct values to make buggy behaves as I would want but increasing friction's should help. After that You probably will have to change spring parameters too.
#7
08/11/2005 (9:27 am)
Daniel,

Thanks. I'll give it a try.

Aaron E.