public static void UpdateLeftHand(ref AvatarState s, int clientId, Context context, RemoteAvatar avatar)
    {
        Assert.IsTrue(clientId == s.clientId);
        if (!s.isLeftHandHoldingCube)
        {
            return;
        }

        var cube = context.cubes[s.leftHandCubeId].GetComponent <NetworkCube>();

        if (!cube.HeldBy(avatar, avatar.GetLeftHand()))
        {
            cube.RemoteGrip(avatar, avatar.GetLeftHand(), s.clientId);
        }

        cube.authorityPacketId = s.leftHandAuthorityId;
        cube.ownershipId       = s.leftHandOwnershipId;
        cube.LocalSmoothMove(s.leftHandCubeLocalPosition, s.leftHandCubeLocalRotation);
    }
Beispiel #2
0
    public static void ApplyLeftHandUpdate(ref AvatarState state, int clientIndex, Context context, RemoteAvatar remoteAvatar)
    {
        Assert.IsTrue(clientIndex == state.client_index);

        if (state.left_hand_holding_cube)
        {
            var cube = context.GetCube(state.left_hand_cube_id);

            var networkInfo = cube.GetComponent <NetworkInfo>();

            if (!networkInfo.IsHeldByRemotePlayer(remoteAvatar, remoteAvatar.GetLeftHand()))
            {
                networkInfo.AttachCubeToRemotePlayer(remoteAvatar, remoteAvatar.GetLeftHand(), state.client_index);
            }

            networkInfo.SetAuthoritySequence(state.left_hand_authority_sequence);

            networkInfo.SetOwnershipSequence(state.left_hand_ownership_sequence);

            networkInfo.MoveWithSmoothingLocal(state.left_hand_cube_local_position, state.left_hand_cube_local_rotation);
        }
    }