I’ve modified that part of the code and it’s working, but only in half screen. If anybody can help…
if ( lastFingerId == fingerID )
{
// Override the tap count with what the iPhone SDK reports if it is greater
// This is a workaround, since the iPhone SDK does not currently track taps
// for multiple touches
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
if ( touch.tapCount > tapCount )
tapCount = touch.tapCount;
}
if ( touchPad )
{
// For a touchpad, let's just set the position directly based on distance from initial touchdown
position.x = Mathf.Clamp( ( touchPosition.x - fingerDownPos.x ) / ( touchZone.width / 2 ), -1, 1 );
position.y = Mathf.Clamp( ( touchPosition.y - fingerDownPos.y ) / ( touchZone.height / 2 ), -1, 1 );
}
else
{
// Change the location of the joystick graphic to match where the touch is
myx = Mathf.Clamp( guiTouchPos.x, guiBoundary.min.x, guiBoundary.max.x );
myy = Mathf.Clamp( guiTouchPos.y, guiBoundary.min.y, guiBoundary.max.y );
angle = Mathf.Atan((myy-30)/(myx-30));
if ( Mathf.Pow(myx-30,2)+ Mathf.Pow(myy-30,2) > Mathf.Pow(50, 2))
{
//var angle : float;
//angle = Mathf.Atan(myy/myx);
gui.pixelInset.x= (Mathf.Cos(angle)*50)+30;
gui.pixelInset.y = (Mathf.Sin(angle)*50)+30;
}
else
{
gui.pixelInset.x = myx;
gui.pixelInset.y = myy;
}
}