public static void UpdateRightHand(ref AvatarState s, int clientId, Context context, RemoteAvatar avatar) { Assert.IsTrue(clientId == s.clientId); if (!s.isRightHandHoldingCube) { return; } var cube = context.cubes[s.rightHandCubeId].GetComponent <NetworkCube>(); if (!cube.HeldBy(avatar, avatar.GetRightHand())) { cube.RemoteGrip(avatar, avatar.GetRightHand(), s.clientId); } cube.authorityPacketId = s.rightHandAuthorityId; cube.ownershipId = s.rightHandOwnershipId; cube.LocalSmoothMove(s.rightHandCubeLocalPosition, s.rightHandCubeLocalRotation); }
public static void ApplyRightHandUpdate(ref AvatarState state, int clientIndex, Context context, RemoteAvatar remoteAvatar) { Assert.IsTrue(clientIndex == state.client_index); if (state.right_hand_holding_cube) { GameObject cube = context.GetCube(state.right_hand_cube_id); var networkInfo = cube.GetComponent <NetworkInfo>(); if (!networkInfo.IsHeldByRemotePlayer(remoteAvatar, remoteAvatar.GetRightHand())) { networkInfo.AttachCubeToRemotePlayer(remoteAvatar, remoteAvatar.GetRightHand(), state.client_index); } networkInfo.SetAuthoritySequence(state.right_hand_authority_sequence); networkInfo.SetOwnershipSequence(state.right_hand_ownership_sequence); networkInfo.MoveWithSmoothingLocal(state.right_hand_cube_local_position, state.right_hand_cube_local_rotation); } }