How would I be able to pivot a model to go forward on the Z axis?

I wanna create a vehicle that’s anchored and can still move. I already made the turning, but I can’t figure out how to correctly move the vehicle forward and backwards.

What I want is to make the vehicle move forward in any rotation

Right now, the turning works, the movement also kind of works but it only goes on the z Axis, so when u turn, it doesn’t go in that direction, it moves only on the z axis. I’ve tried many ways such as creating two separate pivots, but that cancels out the other one. I also tried other methods and it doesn’t work. Here is the main part that I’m struggling with

local vectorFormula = CFrame.new(worldPivot.Position) * CFrame.new(0, 0, math.rad(-throttleAlpha * AlphaTM))
local rotationFormula = worldPivot.Rotation * CFrame.Angles(0, math.rad(-turningAlpha * AlphaSM), 0)

carModel:PivotTo(vectorFormula * rotationFormula)
1 Like

If I understand correctly you are trying to move the model on it’s local axis. I think you might find CFrame.LookVector, CFrame.RightVector, and CFrame.UpVector may be helpful to you! There is also XVector, YVector and ZVector if those more suit your fancy.

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