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

How Would I Make The Camera Move In 3rd Person Like In 1st Person?

Asked by
Optikk 499 Donator Moderation Voter
6 years ago

I have been trying to throw together a camera script that behaves similar to shift-lock, but there are some key differences (that are irrelevant). So first, I offset the camera, and then I made the mouse lock in the center. I then loudly grunted when the camera didn't move at all when I moved the mouse. So the problem here is that I can't seem to figure out how to get the camera moving while the mouse is locked to the center. There are some ugly options that I have that involve incrementing the camera's CFrame, but as I said, it's ugly. So, any ideas on how to get the camera moving? (thank you in advance)

1 answer

Log in to vote
1
Answered by
zyrun 168
6 years ago

ROBLOX has a great solution for this. It moves the camera to an end position and has the camera looking at a Vector3 value the whole time. It looks like this:

--Local script in the player
local Cam = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

print("The move has Started!")

Cam:Interpolate(
    CFrame.new(-20, 20, -20), -- Where the camera will end up
    CFrame.new(10, 10, 10), -- Where the camera is looking, can be a Parts CFrame
    12, -- How long should the move take
)
Cam.InterpolationFinished:Wait() -- This waits for the move to be finished (The dot might have to be a colon, sorry If I messed up but I think I got it right

print("The move has finished!")
0
Thank you Optikk 499 — 6y
Ad

Answer this question