- Home /
Two view and Two function for the Mouse Cursor
Hi there,
There is two camera view in my scene each camera having the script. One camera having the zoom in-out function for the one object and other camera having the first person shooter. I am moving the cursor on my first camera view the object is rotating and also my first person shooter also rotating, this is the bug.
When i move the cursor on my first camera the object only rotate the first person shooter should not rotate/
When i move the cursor on my second camera view my first person shooter only rotate, should not rotate that object.
Help me to do this.
Thanks.
Your question is almost impossible to understand. Please edit your question, and explain in more detail what you mean by : When i move my mouse cursor to one camera to another camera even after my object is rotating
Watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers
Edit : nope, try again. each camera having the script .... what script? The $$anonymous$$ouseLook script? Where are the cameras positioned? Are they both active? What are they showing? What does When i move the cursor on my first camera mean? Are you selecting a camera with the cursor?
Perhaps you should edit your question again, and include a screenshot to make the setup clearer to everyone.
first camera having the rotation script for object and second camera having the rotation script for the first person shooter.
Answer by Loius · Apr 08, 2013 at 07:42 AM
You need to determine which camera the mouse is in before doing the camera's function. You can use Input.mousePosition to get a Vector2 which represents the mouse X and Y, and then do something like:
if ( Input.mousePosition.x < Screen.width*0.5 ) DoRotation(); else DoShooting();
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
accessing a script that is on multiple objects 2 Answers
FPS Camera moving by my left mouse button 1 Answer
Top down camera 1 Answer
how to switch camera 2 Answers