Hello there, I'm having a difficult time trying to make a vehicle not to drift. It works using BodyForce and BodyAngularVelocity.
So far what I have is: A Force (F) that makes it go forward depending on the direction the vehicle is pointing at. A Centripetal Force (Fc) that makes the vehicle turn without any drift.
When the speed of the vehicle goes over 50, F = Vector3.new(0,0,0). It worked perfectly until I added the Fc. Since then, the vehicle won't stop having its speed increased while the vehicle is turning. If the vehicle is not turning, the vehicle won't accelerate.
This is my code involving Fc:
local centripetalForce = mass * Speed * angularVelocity local centripetalVector = centripetalForce * (Vehicle.Body.CFrame.RightVector * Vector3.new(1,0,1)).unit if Speed > maxSpeed then Force = 0 else Force = mass * Acceleration end Force = Force - centripetalVector.Magnitude local Direction = (Player.HumanoidRootPart.CFrame.lookVector * Vector3.new(1,0,1)).unit local YCoord = workspace.Gravity * mass Vehicle.Body.BodyForce.Force = (Vector3.new(0,YCoord,0) + Direction*Force) + (centripetalVector)
There are no problems involving how the other variables were computed. Thank you so much for helping!