Hi.
I’m currently working on a vehicle system that uses both BodyVelocities and BodyGyros. BodyVelocities work fine, but there’s a problem when using BodyGyros.
My car should turn 1 degree repeatedly if the “D” key is being pressed. To do this, I detect when the “Steer” value in a VehicleSeat changes, and if it’s 1 then make the car turn 1 degree to the right. Same with the left.
The current issue I’m having is that, no matter what I do, I can’t figure out how to turn the car properly. A value higher than 20 will make the car turn WAY too much, while setting it to 20 or 1 makes the vehicle turn slower than what I need.
Below is a video showing the issue I have.
And here’s the piece of code I’m having issues with.
if script.Parent.Steer == 1 then
repeat
script.Parent.Parent.Main.BodyGyro.CFrame = CFrame.lookAt(script.Parent.Position, script.Parent.Parent.Main.Position) * CFrame.Angles(0,30,0)
wait(0)
until script.Parent.Steer ~= 1
end
I’ve set it to 30 to show you how it’s turning way more than 30 degrees. I’m so sorry if this topic already exists somewhere but I just couldn’t manage to find it nor in the Dev forum nor in other scripting websites.
Please tell me if there’s a fix to this or if I’m doing anything wrong.
Thank you!