Esempio n. 1
0
        public override void Deserialize(NetDataReader reader)
        {
            Vector3 pos = new Vector3(reader.GetFloat(), reader.GetFloat(), reader.GetFloat());

            Debug.Log($"READ POS: {pos}");
            PLocomotion.SetPosition(pos, false);
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
 public void SetPositionRPC(Vector3 position, bool snapAnimator)
 {
     m_CharacterLocomotion.SetPosition(position, snapAnimator);
 }