- Home /
proximity, keypress and mouse lock help please :)
hey guys :D
im just messing around with unity trying to get the hang of how it all works.
im a programmer :S..might not mean much :S.
anyways, iv come to a little roadblock that i cant really pass.
1: i need to find a way to lock the mouse position to the center of the screen, yet still be able to look around.
2: i need to find a way to lock the screen from moving, and be able to move the mouse around without moving the players view.
3: iv made a cylinder (for the sake of the test) that is solid and everything. but i need to make it so that when your in a certain distance from the cylinder, you press the designated k (just e will do), it pops up a menu (thats why i need to lock the screen and stop it from moving, and still be able to move the mouse)
any help is appreciated :D
thanks in advance.
Answer by AngryOldMan · Mar 22, 2011 at 11:58 AM
if it's a pause menu you would benefit from something like
function Update ()
{
if (Input.GetButtonDown ("p"))
{
if (GUIshow == 0)
{
Time.timeScale = 0.0;
GUIshow = 1;
}
else
{
GUIshow = 0;
Time.timeScale = 1.0;
Time.fixedDeltaTime = 0.02 * Time.timeScale;
}
}
}
This should cover the 2nd two questions, You can always press Esc key in game and it will show your mouse (however it still moves your character's view) so you need to "pause" the game. As for your 1st question http://unity3d.com/support/resources/tutorials/fpstutorial.html check out the FPS tutorial, there should also be a 1st person mouse look script in the standrard assetts but hav'nt used them since several versions ago so I'm no scholar regarding them.
and your comment doesn't really give me any information as to how anyone can help.