Esempio n. 1
0
    void moveToView(Vector3 a, Vector3 b)
    {
        //Vector2 center = new Vector2((a.x + b.x)/2f, (a.y + b.y)/2f);
        float maxDistance = Vector3.Distance(a, b) + 15;

        bool usingHeight = Mathf.Abs(a.x - b.x) / Mathf.Abs(a.y - b.y) > ((0f + Screen.width) / (0f + Screen.height));

        float scaleFactor = -0.75f * (usingHeight ? Screen.height : Screen.width) / 976f;

        //this.transform.position = new Vector3(a.x, a.y, maxDistance * scaleFactor + 1f);
        elasticConnection.ResetMovementRelation(new Vector3(a.x, a.y, maxDistance * scaleFactor + 1f));
        //elasticConnection.ResetRotationRelation(new Vector3(0, 0, centralCube.rotation.eulerAngles.x + 90f));
    }