- Home /
an interesting MouseLook script issue
hello,
Im sure your all familiar with the default Mouselook script in the fps controller. when you move your mouse the camera doesn't quite catch up with the cursor and so the cursor is not in the middle of the screen. My question is can I quickly modify the script to keep the cursor in the middle of the screen and how, or do I have to make a whole other script that does it entirely differently?
thanks in advance.
Answer by flaviusxvii · Jun 15, 2011 at 06:00 PM
Hide the mouse cursor. Draw crosshairs.
tried that doest seem to change anything, its the lazy camera i supose you could call it that i have an issue with, but thanks anyways
@$$anonymous$$ C : I don't get that... why doesn't it change anything?
If you disable and lock the $$anonymous$$ouse cursor it isn't visible anymore
http://unity3d.com/support/documentation/ScriptReference/Screen-lockCursor.html
If you use a GUITexture or something like that as crosshair it will be displayed always at the same position...
oh lock cursor is different i didnt know you could do that
Answer by aldonaletto · Jun 15, 2011 at 07:50 PM
The cursor is not supposed to guide the camera - the camera just follows mouse movement, but not at the same pace as the cursor. You can add a cheap crosshair doing the following:
Create a GUIText and modify its properties in the Inspector:
Text: +
Anchor: middle center
Alignment: center
Select also the font and a reasonable size (say, Arial and size=30)
Set Position to 0.5 0.5 0
And it's ready! Now this cheap crosshair will be kept exactly at the center of the screen. If it works for you, but you want a more sophisticated aim, draw a crosshair and use GUITexture instead of GUIText. But if what you really want is the camera to follow the cursor, then the mouseLook script should be replaced.
thats perfect apart from the fact that in my game the cursor shoots a ray, can i get send out a ray from the middle of the screen? thanks guys
all fixed, thanks guys i made it shoot a ray from the middle of the screen and then hid the cursor and drew a new one
Your answer
Follow this Question
Related Questions
Simple FPS Movement Not Working 0 Answers
Unity 5 access First Person Controller Mouse Look Sensitivity via script 3 Answers
Save Camera Rotation ERROR (HELP!!!!) 1 Answer
player view Rotation check 0 Answers
Mouse look on right click 2 Answers