Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Custom Camera keeps attempting to return to the original position? I think I am doing my math wrong?

Asked by 5 years ago
Edited 5 years ago

I have been working on a custom camera script. It basically emulates right click constantly being pressed. But the problem is it keeps trying to return to the original position.

https://gyazo.com/4c6ed3303db3971553891c399a856bd0

There is a gif of me trying to move the camera around with the mouse and see how it tries to go back to the original position.

function UpdateCameraPosition()

local CameraRotation = CameraRotation + UserInputService:GetMouseDelta() * math.rad(.25)

local CameraRotationCFrame = CFrame.Angles(0, CameraRotation.X, 0) * CFrame.Angles(CameraRotation.Y, 0, 0)

Camera.CFrame = CameraRotationCFrame + Character.PrimaryPart.Position + (CameraRotationCFrame * Vector3.new(0, 0, 5))

end

Thank you for your time. Also how do I put everything into a code block it keeps trying to make me do it 1 line at a time?

0
"Also how do I put everything into a code block it keeps trying to make me do it 1 line at a time?" highlight the text and click the code format icon (looks like < >) Twinbrotato 543 — 5y

Answer this question