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

How to keep the Camera locked at a position while following a Player's own Position?

Asked by
xPolarium 1388 Moderation Voter
7 years ago

Camera Manipulation is a pain for me. When I work on it for one simple thing, the next is just impossible or extremely hard for me to get right.

This time I want to have the camera to be locked on a part (BrickA) while following the position of a player if they are moving around in the world. Sounds simple but the following script I have seems to not want to do this even though I've read what each property of the Camera Object does (CameraSubject, Focus, and CFrame).

wait(3)
print("Start")

while true do
    game.Workspace.CurrentCamera.CameraSubject = game.Workspace.Player1.Head --This should have the Camera look at the head of the Player.

    game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(game.Workspace.CameraBricks.BrickA.Position) --This should be locking the camera to BrickA's Position.

    wait()
end

It's a basic script and I became frustrated with the last script after deleting it in rage so that's why there's no local variables setting currentCamera or LocalPlayer.

1 answer

Log in to vote
1
Answered by
Fatul 9
7 years ago
Edited 7 years ago

http://wiki.roblox.com/index.php?title=API:Class/Camera/CameraType

I'm not sure if its the ones you want but there's a few that are similar to what you want.

Fixed : Camera is stationary.

Attach : Camera moves with the subject at a fixed offset and will rotate as the subject rotates.

Track: Camera moves with the subject but does not rotate automatically.

Watch : Camera is stationary but will rotate to keep the subject in the center of the screen.

0
A simpler explanation of what these Types did helped. Thanks! xPolarium 1388 — 7y
Ad

Answer this question