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

Rotating Camera relatively to the subject?

Asked by
KoreanBBQ 301 Moderation Voter
9 years ago

Hello,

I'm trying to make it so when you press a key, it rotates the camera 90 degrees. By default, I have a script setting your camera to : cam.CoordinateFrame=CFrame.new(plr.Character.Torso.CFrame.p+currentCamView,plr.Character.Torso.Position)

currentCamView = Vector3.new(0,15,20)

I want it to rotate 90 degrees clockwise, but I want it to stay in that kind of top-down view,

kinda complicated the way I say it, but the best I have rn is:

local angle=3
        for i=1,25 do
            cam.CoordinateFrame=CFrame.new(cam.CameraSubject.Parent.Head.Position)*CFrame.Angles(0,math.rad(angle),0)
            angle=angle-3
            wait()
        end

it doesnt stay in the top down view and it doesnt rotate differently according to where youre facing help

Answer this question