This is my first post on the gavedev.net forum. Hi all!!!
I'm finally working on my first car simulator project, and I'm getting to the point where tires become important.
I'm experiencing a problem - which is probably one that most people have run into - where at low speeds, slip angle and ratio based off velocity start to become imprecise.
For people who don't know, if my forward velocity is 0 and my lateral velocity is 0.0000000001, then my slip angle solves to 90 degrees, which jerks my car to the side.
Here is my code on getting slip angle and ratio, which is based off velocity. My simulation uses a Y up axis.
local slipAngle = math.asin(velocity.X)
local slipRatio = (velocity.Z-self.spin*self.tireRadius)/math.abs(velocity.Z)
if slipRatio ~= slipRatio then slipRatio = 1 end -- NaN, incase dividing by zero
At very speeds, my car ends up being shoved around due to precision, and isn't stable.
If you need any more info on my code or how I'm implementing different things, please dont be scared to ask.
If anybody well-versed in vehicle dynamics is able to send me papers I can read or solutions I can implement for both slip ratio and angle to improve it, it would really help. Thanks!