Beispiel #1
0
        /// <summary>
        /// Updates the remote character's transform values.
        /// </summary>
        private void Update()
        {
            // Local players will move using the regular UltimateCharacterLocomotion.Move method.
            if (m_PhotonView.IsMine)
            {
                return;
            }

            // When the character is on a moving platform the position and rotation is relative to that platform. This allows the character to stay on the platform
            // even though the platform will not be in the exact same location between any two instances.
            var serializationRate = (1f / PhotonNetwork.SerializationRate) * m_RemoteInterpolationMultiplayer;

            if (m_NetworkPlatform != null)
            {
                m_NetworkPlatformPrevRelativePosition = Vector3.MoveTowards(m_NetworkPlatformPrevRelativePosition, m_NetworkPlatformRelativePosition, m_Distance * serializationRate);
                m_CharacterLocomotion.SetPosition(m_NetworkPlatform.TransformPoint(m_NetworkPlatformPrevRelativePosition), false);

                m_NetworkPlatformPrevRotationOffset = Quaternion.RotateTowards(m_NetworkPlatformPrevRotationOffset, m_NetworkPlatformRotationOffset, m_Angle * serializationRate);
                m_CharacterLocomotion.SetRotation(MathUtility.TransformQuaternion(m_NetworkPlatform.rotation, m_NetworkPlatformPrevRotationOffset), false);
            }
            else
            {
                m_Transform.position = Vector3.MoveTowards(m_Transform.position, m_NetworkPosition, m_Distance * serializationRate);
                m_Transform.rotation = Quaternion.RotateTowards(m_Transform.rotation, m_NetworkRotation, m_Angle * serializationRate);
            }
        }
Beispiel #2
0
 public void SetRotationRPC(Quaternion rotation, bool snapAnimator)
 {
     m_CharacterLocomotion.SetRotation(rotation, snapAnimator);
 }