Это код:
Код: Выделить всё
void Start ()
{
valueOfHeight = (Screen.height * 110 )/ 320;
valueOfWidth = (Screen.width * 110 )/ 480;
Boundaries = new Bounds (new Vector3(Screen.width/2,Screen.height/2,0f),new Vector3(Screen.width - valueOfWidth,Screen.height - valueOfHeight,0f));
}
void Update ()
{
if (gameObject.transform.position.x > Cornerpoints[1].transform.position.x
&& gameObject.transform.position.x < Cornerpoints[3].transform.position.x
&& gameObject.transform.position.y > Cornerpoints[1].transform.position.y
&& gameObject.transform.position.y < Cornerpoints[3].transform.position.y)
{
Debug.Log("1");
gameObject.transform.position = Boundaries.ClosestPoint(gameObject.transform.position);
if (Boundaries.Contains (gameObject.transform.position))
{
Debug.Log("2");
direction = new Vector3 ((Input.acceleration.x), (Input.acceleration.y), 0);
}
Но это происходит не со всех сторон, почему?
Подробнее здесь: https://stackoverflow.com/questions/394 ... -the-scene
Мобильная версия