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

Can I force a player to only look straight ahead?

Asked by
ipiano 120
10 years ago

I know it's possible to manipulate the camera so that it is locked in firstPerson, or so that the player can't look to the sides, but with all of my manipulations, the player is still able to look up and down. Is there a way to disable that? The only thing I can think of is to set the camera mode to fixed and update it in a while loop so that it points at the right spot, but that seems clumsy to me. Is there a better way to do it?

2 answers

Log in to vote
0
Answered by 10 years ago

If you set the CameraType to "Scriptable", it isn't affected by environmental changes or user input, only by scripts. You can then position or rotate the camera however you like. If you're going to have the camera's position update constantly, then I recommend using RenderStepped to do so. RenderStepped is an event of the RunService that fires every 1/60th of a second, making it twice as fast as wait(), which waits 1/30th of a second. You can use it like this:

game:GetService("RunService").RenderStepped:connect(function()
    --Put code here
end)

Hope this helped!

Note: For more information on RenderStepped, click here: RenderStepped

Ad
Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

Try making a part above their head and setting their CameraSubject to that part. It's automatically fixed. Good temporary - ultimate way of making them look in a certain direction.

-Goulstem

Answer this question