Hover script height inconsistencies

I have a raycast suspension car (so basically just a hovercar) that is supposed to be elevated a fixed amount above the ground. However, since I am multiplying the calculated force by the car’s CFrame UpVector, the height gets increased when the car is resting on a steep incline.

Normal height:

d65c5139b138898efc5959c21f53df7c

Incline height:

Here is the (simplified) spring code:

local offset = (rideheight-ray.Distance)
local velocity = upv:Dot(car:GetVelocityAtPosition(raypos))
local force = (offset * tune.springstiffness) - (velocity * tune.springdamping)
spring.Force = force*upv.Unit

Not sure what to do in this situation, since interfering with the ride height can cause problems. Any help is appreciated.

1 Like