Top Down Car Simulation (Demo & Code)

One of the controllers released is b2TensorDampingController, which does a very similar form of wheel behaviour quite nicely. It's the 4th example in this demo. Note real wheels need some angular damping too.
Tensor damping is what you need to the wheels. If you apply a tensor damper on all 4 wheels and then rotate the front wheels you get what you are looking for. Just as in real life, a wheel applies little resistance in the forward direction while applying loads in the sidewards direction.
CyberPunK wrote:...i noticed the problems thack mack also noticed. The car seems to go faster at some angle and sometimes it steers faster then normal. I guess it has something to do with the killOrthogonalVelocity function, but i wasn't able to find out a solution.
It was caused by this bug.
Cool! I want to play with your code but it won't compile. Which Box2D version you have used??
I used Box2D Flash AS3 2.0.1, without any of the patches.
Hi again everyone.

I downloaded Boris's Controller pack (cheers boris!) and i managed to get Tensor damping on a body but im not really sure what im doing with it to make it act like a "top down wheel". I basically want to use the keys to rotate it and the up key should apply some sort of force along the rotation....

I tried to use Andriods example code to see how to do this (without the Tensor Controller) but like the others, im struggling to get it working and so cant even replicate it with the source in front of me.

Seeing a search on this seems quite common, can anyone give me (and possibly future people) some advice?

Cheers!

Clark.
clark, android's code works very well with latest svn fixes. although it claims to "kill orthogonal velocity", natural skidding occurs due to joints; but if you want additional "tensor" damping, simply modify killOrthogonalVelocity() to add small amount of targetBody.GetXForm().R.col1 in.
I think thats where i am getting confused.

It has only been in the past 12 hours that i have noticed the getXForm() and i have no idea what the .r.col1 and .r.col2 is referring to.

Cheers,

Clark.
apparently R is rotation matrix and colX are its columns, coincidentally forward and sideways directions (of the wheel). non-uniform aka "tensor" damping means different damping along these directions. in case of wheel, you would want little damping in forward direction and larger damping in sideways direction.
ps.this is a sweet example. it wascoolof you to share.
i was trying to figure out box2d with the complexity of so many classes,so it's great you shared
it always alove hate relantionship with frameone as eh?

Original thread: https://box2d.org/forum/viewtopic.php?t=1547