I have been watching this guy on Youtube and he has made a series of tutorials for MMORPG games for unity. I downloaded one of his scripts which he released which was the camera movement however when you left click the camera rotates, When you right click the camera rotates again! I want to make it so it only rotates when the right button is held down to rotate.
I know there have been previous answers about it however when i tried the solutions they didnt work cause i must have placed them in the wrong place.
This is the camera rotate for my game however it works for both left and right buttons.
// If either mouse buttons are down, let the mouse govern camera position
if (GUIUtility.hotControl == 0)
{
if (Input.GetMouseButton(0) || Input.GetMouseButton(1))
{
//Check to see if mouse input is allowed on the axis
if (allowMouseInputX)
xDeg += Input.GetAxis ("Mouse X") * xSpeed * 0.02;
else
RotateBehindTarget();
if (allowMouseInputY)
yDeg -= Input.GetAxis ("Mouse Y") * ySpeed * 0.02;
//Interrupt rotating behind if mouse wants to control rotation
if (!lockToRearOfTarget)
rotateBehind = false;
}
// otherwise, ease behind the target if any of the directional keys are pressed
else if (Input.GetAxis("Vertical") != 0 || Input.GetAxis("Horizontal") != 0 || rotateBehind)
{
//RotateBehindTarget();
}
}
P.S - I have just started Unity so i have only just made the account however i am willing to share and release my progress to help the community once i am advanced at Unity.
Thanks in advanced.