예제 #1
0
    /// <summary>
    /// Handles the callback from Teleportal for repositioning this Item.
    /// </summary>
    /// <param name="position">The new position for this Item.</param>
    /// <param name="euler">The new rotation for this Item.</param>
    public void RepositionCallback(Vector3 position, Vector3 euler)
    {
        if (Type == XRItemType.Player)
        {
            // Animate to new position & rotation
            StartCoroutine(MovementHelper.AnimateMoveRotateTo(transform, position, euler, 0.5f));
        }
        else
        {
            // Set new position & rotation
            transform.position    = position;
            transform.eulerAngles = euler;
        }

        // Notify listeners (if there are any)
        if (OnRepositioned != null)
        {
            OnRepositioned();
        }
    }