is there anyone could help about ....

i’m just a beginner on using Unity3d but I do have experience in scripting in JavaScript.

here is my problem :

I want to focus my Camera in one place and whenever I move my mouse the Camera is still in position but my crosshair is the one moving. this is a FPS.

anyone can give me some advice or Script that can help me with this problem.

i know this is just a simple problem. ^^-- but your advice and tips will make me better. haha.

Thanks in advance. and have a great day.

In your Project List, try searching for “first person controller” that might help you out.

Try These,2 “shiftStop” examples, and tweak them to your liking.

<>

var MainCamera: GameObject;

function Update () {
if(Input.GetKeyDown(KeyCode.RightShift)){
GameObject.Find(“MainCamera”).GetComponent(“MouseLook”).enabled=false;

}
if(Input.GetKeyUp(KeyCode.RightShift)){
GameObject.Find(“MainCamera”).GetComponent(“MouseLook”).enabled=true;

}
}
<>

or:

<>
var MainCamera: GameObject;

function Start() {
GameObject.Find(“MainCamera”).GetComponent(“MouseLook”).enabled =false;
}

function Update () {
if(Input.GetKeyDown(KeyCode.RightShift)){
GameObject.Find(“MainCamera”).GetComponent(“MouseLook”).enabled=true;

}

if(Input.GetKeyUp(KeyCode.RightShift)){
GameObject.Find(“MainCamera”).GetComponent(“MouseLook”).enabled=false;

}
}

<>

Both of those suggestions are based around having the mouse move the camera; I think what the OP wants is just to replace the mouse cursor with a cross-hair graphic, so that moving the mouse moves the cross-hair without affecting the character position or camera rotation or anything else.

@jaysonm009: if that’s the case, try searching the forums for ‘custom mouse cursor’ or similar; there are lots of examples. Simply stated, all you need to do is

  • create an empty GameObject, attach a script to it, and in that script’s OnGUI() function use GUI.DrawTextue() to draw the cross-hair texture at the mouse position
  • disable the default mouse cursor (do that after you’ve got the previous part working, to avoid confusion :wink: