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

How to prevent a player from turning their player with Mouse Lock?

Asked by
StoIid 364 Moderation Voter
7 years ago

I am making a chest script and when the player presses E to open the chest, they are positioned so that they are facing the chest.

I do not want the player to be able to turn in any way because it'll look unrealistic so I need help disabling mouse lock temporarily, or preventing the person from being able to turn at all, for that short moment.

The reason I need this is also because an animation will be played while opening the chest, so again, i need it to look as realistic as possible.

Gif of The Chest and My Issue

2
I believe if you have a script that changes the current camera type to scriptable they won't be able to move it and you can change it back afterwards, MrLonely1221 701 — 7y
0
Thanks that worked! StoIid 364 — 7y
0
Glad I could help. MrLonely1221 701 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

This question has been answered already. The solution for anyone who was wondering, was adding a script that would change the CurrentCamera type to Scriptable and then changing it back after the animation was over.

Ad

Answer this question