Hey,
I have been working on a spaceship racing game, and I have been trying to get the ship to turn depending on how much the player moved the mouse(This has worked before, but I needed to adjust it so it didn’t slide around).
This is the part that calculates the CFrame I need to move the plane to:
local gyroCF = stepCF + CFrame.Angles(math.rad(-TargetAngles.X), math.rad(-TargetAngles.Y), 0)
This is the definition of stepCF(lastSeat is a valid part)
local stepCF = CFrame.fromMatrix(lastSeat.Position, lastSeat.CFrame.XVector, lastSeat.CFrame.YVector, lastSeat.CFrame.ZVector)
This is the declaration of TargetAngles(Worked when it was still sliding)
local mouseDelta = controlService:GetMouseDelta() --controlService = UserInputService
--Stuff that would tell if the mouse moved or not
TargetAngles = mouseDelta --TargetAngles was declared before
This is the error I get (at the line where I calculate gyroCF)
![]()
I have tried many things, and all of them resulted in this.(Changing declarations, turning something into a variable, compacting code)
Please help. Thanks.
Edit: I looked back at my old code, and it also doesn’t change anything. I think that stepCF, despite being a CFrame, is being registered as a Vector3. How would I fix this?
I also had this as my old version of stepCF
camera.CFrame + camera.CFrame.LookVector * 100