Пример #1
0
    public void Drop()
    {
        // Null check
        if (!currentInteractable)
        {
            return;
        }

        // Method called before drop
        currentInteractable.OnDrop(this);

        // check if kinematic or physics based
        if (currentInteractable.GetComponent <Rigidbody>().isKinematic)
        {
            currentInteractable.transform.parent = null;
        }
        else
        {
            // Apply velocity
            Rigidbody targetBody = currentInteractable.GetComponent <Rigidbody>();
            targetBody.velocity        = pose.GetVelocity();
            targetBody.angularVelocity = pose.GetAngularVelocity();

            // Detach
            joint.connectedBody = null;
        }

        // Clear active hand
        currentInteractable.activeHand = null;
        currentInteractable            = null;
    }
Пример #2
0
    public void Drop()
    {
        // Null check
        if (!currentInteractable)
        {
            return;
        }

        // Method called before drop
        currentInteractable.OnDrop(this);

        // Apply velocity
        Rigidbody targetBody = currentInteractable.GetComponent <Rigidbody>();

        targetBody.velocity        = pose.GetVelocity();
        targetBody.angularVelocity = pose.GetAngularVelocity();

        // Detach
        joint.connectedBody = null;

        // Clear
        currentInteractable.m_ActiveHand = null;
        currentInteractable = null;
    }