public virtual void Grab(GrabItem item)
    {
        GameObject collidingObject = item.GetCollidingObject();

        collidingObject.transform.SetParent(this.transform);
        collidingObject.GetComponent <Rigidbody>().isKinematic = true;
    }
    public override void Grab(GrabItem item)
    {
        GameObject collidingObject = item.GetCollidingObject();

        if (collidingObject != null && collidingObject.tag == "FlightStick")
        {
            Transform anchor =
                item.HandType == XRNode.RightHand
                ? collidingObject.transform.GetChild(0).GetChild(0).GetChild(0)
                : collidingObject.transform.GetChild(0).GetChild(0).GetChild(1);

            collidingObject.GetComponent <FlightStick>().SetHand(item.Hand);
            item.HandModel.position = anchor.position;
            item.HandModel.rotation = anchor.rotation;

            item.HandModel.SetParent(anchor);
        }
    }
Exemplo n.º 3
0
    public override void Grab(GrabItem item)
    {
        GameObject collidingObject = item.GetCollidingObject();

        if (collidingObject != null && collidingObject.tag == "Throttle")
        {
            collidingObject.GetComponent <ThrottleControl>().IsGrabbed = true;

            Transform anchor =
                item.HandType == XRNode.RightHand
                ? collidingObject.transform.GetChild(0)
                : collidingObject.transform.GetChild(1);

            item.HandModel.position = anchor.position;
            item.HandModel.rotation = anchor.rotation;

            item.HandModel.SetParent(anchor);
        }
    }