コード例 #1
0
    public void RemoteGrip(RemoteAvatar avatar, RemoteAvatar.Hand hand, int clientId)
    {
        Assert.IsTrue(clientId != context.clientId);
        Release();
        var body = gameObject.GetComponent <Rigidbody>();

        hand.grip             = gameObject;
        body.isKinematic      = true;
        body.detectCollisions = false;
        gameObject.transform.SetParent(hand.transform, true);
        remoteAvatar = avatar;
        remoteHand   = hand;
        holderId     = clientId;
        authorityId  = clientId + 1;
        avatar.CubeAttached(ref hand);
    }
コード例 #2
0
    /*
     * Detach cube from any player who is holding it (local or remote).
     */
    public void Release()
    {
        if (!HasHolder())
        {
            return;
        }

        if (localAvatar)
        {
            localAvatar.DetachCube(ref localHand);
            touching.GetComponent <BoxCollider>().isTrigger = true;
        }

        if (remoteAvatar)
        {
            remoteAvatar.DetachCube(ref remoteHand);
        }

        localAvatar  = null;
        localHand    = null;
        remoteHand   = null;
        remoteAvatar = null;
        holderId     = Nobody;
    }
コード例 #3
0
 public bool HeldBy(RemoteAvatar avatar, RemoteAvatar.Hand hand) => remoteAvatar == avatar && remoteHand == hand;