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); }
/* * Attach cube to remote player */ public void AttachCubeToRemotePlayer(RemoteAvatar avatar, RemoteAvatar.HandData hand, int clientIndex) { Assert.IsTrue(clientIndex != m_context.GetClientIndex()); DetachCubeFromPlayer(); hand.gripObject = gameObject; var rigidBody = gameObject.GetComponent <Rigidbody>(); rigidBody.isKinematic = true; rigidBody.detectCollisions = false; gameObject.transform.SetParent(hand.transform, true); m_remoteAvatar = avatar; m_remoteHand = hand; m_holdClientIndex = clientIndex; m_authorityIndex = clientIndex + 1; avatar.CubeAttached(ref hand); }