Hello,
I'm in the middle of making a futuristic racer, and in essence I'm using a sort of spring to keep the ships hovering above the track.
Very simple process. I cast a ray out of the bottom of the ship, along it's Y axis, and if the ray hits the road I calculate the magnitude of the penetration distance into the road.
Then simply do
velocity += roadNormal * (penetrationMag * k)
where k is 0.01
Obviously this does keep the ship hovering, but with constant bobbing up and down. I've tried a few (probably hacky) things, but just can't stop it at all.
Any good ideas of how to implement damping on a simple spring system like this?
Cheers.