Log in to vote

Making part rotate with camera?

Asked by 13 days ago
Edited 13 days ago

Currently, the part spins wildly, even setting math.deg(camY) to a constant number makes it spin crazy. This causes the park to just do donuts. What I want the part to move (only on a 2D plane, it should not go up/down) in the direction that the camera is facing. For example if the camera is pointing top-down, the part should move "up" as seen from the camera, and if the camera is lower at a 45 degree yaw, the part should move in that direction. I think the issue I'm having is converting that 3D camera orientation to 2D orientation.

while #pressedKeys ~= 0 do
    local targetPart = workspace:FindFirstChild("targetPartTemp")
    local camX, camY, camZ = cam.CFrame:ToEulerAnglesXYZ()
    targetPart.CFrame *= CFrame.Angles(0,math.deg(camY),0)
    targetPart.CFrame *=,0,-1)
math.rad(camY) greatneil80 2641 — 12d

Answer this question