Beispiel #1
0
    void FixedUpdate()
    {
        Ray wandRay = displayManager.ScreenPointToRay(Input.mousePosition);

        if (wandRay.direction != Vector3.zero)
        {
            // TUUKKA:
            if (rigidbody)
            {
                rigidbody.MovePosition(wandRay.origin);
                rigidbody.MoveRotation(Quaternion.LookRotation(wandRay.direction));
            }
            else
            {
                // TUUKKA: This was the original code
                transform.position = wandRay.origin;
                transform.rotation = Quaternion.LookRotation(wandRay.direction);
            }
        }
    }
Beispiel #2
0
    void FixedUpdate()
    {
        Ray wandRay = displayManager.ScreenPointToRay(Input.mousePosition);

        wandRay.origin = wandRay.origin + (wandRay.direction * distanceFromCameraLerped);

        if (wandRay.direction != Vector3.zero)
        {
            // TUUKKA:
            if (GetComponent <Rigidbody>())
            {
                GetComponent <Rigidbody>().MovePosition(wandRay.origin);
                GetComponent <Rigidbody>().MoveRotation(Quaternion.LookRotation(wandRay.direction));
            }
            else
            {
                // TUUKKA: This was the original code
                transform.position = wandRay.origin;
                transform.rotation = Quaternion.LookRotation(wandRay.direction);
            }
        }
    }