Raycast Car Friction being erratic

My car is having issues staying straight. The friction forces sometimes randomly exceed absurd numbers, causing cars to fling or spin out of control.

My calculations

local LocalVel = carpos:VectorToObjectSpace(car.AssemblyLinearVelocity)

local FrictionForce = carpos.RightVector * -LocalVel.X * RollingResistance

Vid of it happening: Desktop 2023.09.13 - 16.36.22.02.DVR_Trim

1 Like

maybe instead of having just the X of being the axis try using the Y axis too (tbh idk this was just a guess cuz i am a noobie scripter trying to learn):frowning:

1 Like

Thank you for trying! I’m positive the Y axis wouldn’t help because we’re using the reverse of the X velocity to try to minimize movement on the X axis. The Y axis is irrelevant because the car doesn’t move much on that axis

ohhh ok thx tho for explaning cuz tbh i don t a lot

1 Like

Are u using a vector force to apply force to the car?
If you are using a vector force, is the RelativeTo property of the vector force set to Attachment0?
If it is, then that’s probably what causes the issue, you can fix it with two ways

  1. Set VectorForce RelativeTo to World
  2. In the FrictionForce variable replace the carpos.RightVector to Vector3.xAxis

The second way works because RelativeTo Attachment0 will automatically convert the forces from object space to world space

I’m going to try this. thank you!

This worked. I can’t believe how many different equations I tried, thinking my math was incorrect. Thank you so much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.