Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I rotate a players camera angle by 90 degrees?

I'm not sure on how I would go about doing this. Here's a bit of a demonstration.

https://imgur.com/a/gV0Xw

Basically what I'm trying to do is when the player joins the game with the camera facing upwards, which is pretty simple. I'm not sure on how I would rotate the camera smoothly to face forwards. It sounds a bit wonky but the outcome will be quite a sight.

Anyone have any ideas?

P.S. I'm not asking for a full script, just where to look.

1 answer

Step 1: Decide goal cframe... offset by 90 degrees down?

local goal = camera.CFrame * CFrame.Angles(math.pi/-2,0,0) 

Step 2: Interpolate. There are a lot of options. Here's one:

camera:Interpolate( goal, goal+goal.lookVector*20, 1 )

the focus bit is strange but I'd simply put it kinda closeby. Hope it works!

2 comments

0

I'm not sure if I'm doing this correctly but it doesn't seem to work. Here's what I've attempted:

0

local camera = workspace.Camera camera.CameraType = Enum.CameraType.Scriptable local goal = camera.CFrame * CFrame.Angles(math.pi/-2,0,0) camera:Interpolate( goal, goal+goal.lookVector*20, 1 )

This discussion is preserved as it was. New answers, comments, and votes are closed.