Hi guys!
Im really done of scripting this script
This script i ve done almost perfect but when im moving camera and second finger touched any zone, camera rotating to another zone
Help me to fix that please or give any another code
I just need to control camera and move player at one time but i cant do it properly
here s the code:
Thanks
void IsOnCameraPanel()
{
if(Input.GetTouch(0).phase == TouchPhase.Began )
{
firstpoint = Input.GetTouch(0).position;
xAngTemp = xAngle;
yAngTemp = yAngle;
firstTouch=true;
}
if(Input.GetTouch(0).phase==TouchPhase.Moved)
{
secondpoint = Input.GetTouch(0).position;
//Mainly, about rotate camera. For example, for Screen.width rotate on 180 degree
xAngle = xAngTemp + (secondpoint.x - firstpoint.x) * 20 * XSensitivity / Screen.width;
yAngle = yAngTemp - (secondpoint.y - firstpoint.y) * 15 * YSensitivity / Screen.height;
//Rotate camera
this.transform.rotation = Quaternion.Euler(yAngle, xAngle, 0.0f);
}
if(Input.GetTouch(1).phase == TouchPhase.Began)
{
firstpoint = Input.GetTouch(1).position;
xAngTemp = xAngle;
yAngTemp = yAngle;
secondTouch=true;
}
if(Input.GetTouch(1).phase==TouchPhase.Moved)
{
secondpoint = Input.GetTouch(1).position;
//Mainly, about rotate camera. For example, for Screen.width rotate on 180 degree
xAngle = xAngTemp + (secondpoint.x - firstpoint.x) * 20 * XSensitivity / Screen.width;
yAngle = yAngTemp - (secondpoint.y - firstpoint.y) * 15 * YSensitivity / Screen.height;
//Rotate camera
this.transform.rotation = Quaternion.Euler(yAngle, xAngle, 0.0f);
}
}