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

First-Person Camera that rotates on all axis?

Asked by 8 years ago

I am attempting to create a first-person camera that behaves like the normal FPS camera, but also rotates sideways, so the camera will turn upside-down if the player flips. Is there a way to do this with the existing FPS camera, or will it need to be custom made? How might I go about doing this?

0
Use :SetRoll() GoldenPhysics 474 — 8y

1 answer

Log in to vote
0
Answered by
Edenojack 171
8 years ago

You can try to incorporate lerping, within the CameraScript in the StarterPlayer there is a line of code that changes the CFrame of the camera, I can't seem to find it anymore, but its in there.

You will need to add in the Head CFrame information into it, although I'm not sure what the best method would be. Perhaps something along the lines of;

local HeadCF = Path to Head's Render CFrame
local HeadAngle = HeadCF-HeadCF.p -- leaves you with just the rotation.

After this you will need to apply it to the changing CFrame; psuedo-code, Cam.CoordinateFrame = Cam.CoordinateFrame:lerp(CameraAimCFrame*HeadAngle,.1) The lerping percentage (2nd variable) needs to be fairly high to be accurate, but not 1. The lower it is, the smoother the camera movement will be, the higher, the sharper.

Be aware though, you'll get people suffering from motion sickness if you use this, this is due to the fact that cameras or any lerping cframe will rotate on their relative Z axis. This can be what you're after, but it will disorientate some.

0
I tried your solution, but it did not work correctly. User#2263 0 — 8y
Ad

Answer this question