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.

first camera having the rotation script for object and second camera having the rotation script for the first person shooter.

1 Answer

1

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();

is there any default function in unity 3d scripting?