I’m currently making a Nascar racing game and have been working on a car controller for a while now. I’ve only tested on flat ground, and now that I’m testing banking (Slightly elevated + angled ground) the car does fall flush against the bank.
Heres what i mean:
As you can see, the car’s tail end is floating instead of following. I think this is because of the BodyGyro updating to keep the orientation still.
What I need help with:
I need to figure out how to rotate BodyGyro on one axis (Y-axis) that is relative to the object’s space only.
What I’ve tried
I’ve tried using CFrame.FromOrientation instead, as well as BodyAngularVelocity (That fixes the problem, but creates a bunch of others too). I was going to try to use CFrame:ToObjectSpace() But I couldn’t figure out how to implement it into my code.
Here’s my code, in case it helps:
if seat.Steer > 0 then
angle.CFrame = angle.CFrame * CFrame.Angles(0,math.rad(turnSpeed),0)
elseif seat.Steer < 0 then
angle.CFrame = angle.CFrame * CFrame.fromOrientation(0,math.rad(turnSpeed),0)
elseif seat.Steer == 0 then
angle.CFrame = angle.CFrame * CFrame.fromOrientation(0,0,0)
end
(There’s more to the code, but I figured this is probably good enough for reference??)