This isn’t the right way to go. Vector3:Dot
is what you need:
function seatMove(humanoid, dir, root)
humanoid.SeatPart.ThrottleFloat = dir:Dot(root.CFrame.LookVector)
humanoid.SeatPart.SteerFloat = dir.Unit:Dot(root.CFrame.RightVector) * humanoid.SeatPart.ThrottleFloat * 2 -- sensitivity
end
--dir is the direction, specify like this:
local dir = targetPosition - root.Position
--root is the HumanoidRootPart of the humanoid (you could use the car seat as well)
I believe your system could work with enough effort, but it would need a dead zone (buffer zone) that is more defined and accurate, which is simply not possible at lower framerates.
I’ve also realized that Roblox’s legacy car system does not respect the floating-point value of SteerFloat
and ThrottleFloat
, and instead converts them to integers. I’ve switched a handful of my cars to LegacyCarConverter and they work much better:
The reason why it works much better is because you can customize the steering angle with the script AND with SteerFloat
. Though that is just my experience.