Using unity's default camera model

Hi, I just started out with Unity and am trying to build my first game following a book, I noticed that the mouse of the game is not locked to the center of the screen initially and you can move the cursor outside of the game view window with the character still looking around. I found this to be a really neat way to control the camera and have an idea how I could use it in my game, unfortunately I’m not exactly sure how to work with this model because all the points on the screen I click on are not really pointed at by the camera’s lookAt vector. Can anyone point me in the right direction, even the name of this model will suffice so I could see how it works. Thanks

Hi Vanillasnake21,

I’m having problems fully understanding what you need. I’m guessing that you may want to be able to hide the mouse and look it to the centre of the screen if so this will do it:

#pragma strict

//Variable to say what state the mouse settings are in.
//true means mouse is hidden and locked.
//false means mouse is visible and free to move.
var mouseHidden: boolean = false;

function Update () {

	//Detects F1 Key on downward press
	if(Input.GetKeyDown(KeyCode.F1)) {
		//Check the mouse setting variable
		if(mouseHidden == true) {
			Screen.showCursor = true;
			Screen.lockCursor = false;
			mouseHidden = false;
		} else {
			Screen.showCursor = false; 
			Screen.lockCursor = true;
			mouseHidden = true;

Hope it helps. If not I will delete this answer and you will maybe need to explain things a little better :wink: