public static UnserializeRotation3D ( NetworkReader reader, AxisSyncMode mode, CompressionSyncMode compression ) : |
||
reader | NetworkReader | |
mode | AxisSyncMode | |
compression | CompressionSyncMode | |
Résultat |
void UnserializeModeTransform(NetworkReader reader, bool initialState) { if (hasAuthority) { // this component must read the data that the server wrote, even if it ignores it. // otherwise the NetworkReader stream will still contain that data for the next component. for (int i = 0; i < m_Bones.Length; i++) { // position reader.ReadVector3(); if (syncRotationAxis != NetworkTransform.AxisSyncMode.None) { NetworkTransform.UnserializeRotation3D(reader, syncRotationAxis, rotationSyncCompression); } } return; } for (int i = 0; i < m_Bones.Length; i++) { var boneInfo = m_BoneInfos[i]; // position boneInfo.m_TargetSyncPosition = reader.ReadVector3(); // rotation if (syncRotationAxis != NetworkTransform.AxisSyncMode.None) { var rot = NetworkTransform.UnserializeRotation3D(reader, syncRotationAxis, rotationSyncCompression); boneInfo.m_TargetSyncRotation3D = rot; } } }
void UnserializeModeTransform(NetworkReader reader, bool initialState) { if (hasAuthority) { // this component must read the data that the server wrote, even if it ignores it. // otherwise the NetworkReader stream will still contain that data for the next component. // position reader.ReadVector3(); if (syncRotationAxis != NetworkTransform.AxisSyncMode.None) { NetworkTransform.UnserializeRotation3D(reader, syncRotationAxis, rotationSyncCompression); } return; } if (isServer && m_ClientMoveCallback3D != null) { var pos = reader.ReadVector3(); var vel = Vector3.zero; var rot = Quaternion.identity; if (syncRotationAxis != NetworkTransform.AxisSyncMode.None) { rot = NetworkTransform.UnserializeRotation3D(reader, syncRotationAxis, rotationSyncCompression); } if (m_ClientMoveCallback3D(ref pos, ref vel, ref rot)) { m_TargetSyncPosition = pos; if (syncRotationAxis != NetworkTransform.AxisSyncMode.None) { m_TargetSyncRotation3D = rot; } } else { // rejected by callback return; } } else { // position m_TargetSyncPosition = reader.ReadVector3(); // rotation if (syncRotationAxis != NetworkTransform.AxisSyncMode.None) { m_TargetSyncRotation3D = NetworkTransform.UnserializeRotation3D(reader, syncRotationAxis, rotationSyncCompression); } } }
void UnserializeModeTransform(NetworkReader reader, bool initialState) { //IMPORTANT: Time critical: Don't put print statements in loop! Makess Unity hang. //print("SN:Unserialize numbones= "+ m_Bones.Length); if (hasAuthority) { // this component must read the data that the server wrote, even if it ignores it. // otherwise the NetworkReader stream will still contain that data for the next component. for (int i = 0; i < m_Bones.Length; i++) { // position reader.ReadVector3(); if (syncRotationAxis != NetworkTransform.AxisSyncMode.None) { NetworkTransform.UnserializeRotation3D(reader, syncRotationAxis, rotationSyncCompression); } } return; } for (int i = 0; i < m_Bones.Length; i++) { var boneInfo = m_BoneInfos[i]; // position Vector3 pos = reader.ReadVector3(); boneInfo.m_TargetSyncPosition = pos; // rotation if (syncRotationAxis != NetworkTransform.AxisSyncMode.None) { var rot = NetworkTransform.UnserializeRotation3D(reader, syncRotationAxis, rotationSyncCompression); //rot = Quaternion.identity; boneInfo.m_TargetSyncRotation3D = rot; if (pos.x == 111 && pos.z == 333) //this joint was not sent, so skip { //Debug.Log ("unserialize count = " + pos.y); boneInfo.valid = false; } } } }
private void UnserializeModeTransform(NetworkReader reader, bool initialState) { if (this.hasAuthority) { reader.ReadVector3(); if (this.syncRotationAxis == NetworkTransform.AxisSyncMode.None) { return; } NetworkTransform.UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression); } else if (this.isServer && this.m_ClientMoveCallback3D != null) { Vector3 position = reader.ReadVector3(); Vector3 zero = Vector3.zero; Quaternion rotation = Quaternion.identity; if (this.syncRotationAxis != NetworkTransform.AxisSyncMode.None) { rotation = NetworkTransform.UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression); } if (!this.m_ClientMoveCallback3D(ref position, ref zero, ref rotation)) { return; } this.m_TargetSyncPosition = position; if (this.syncRotationAxis == NetworkTransform.AxisSyncMode.None) { return; } this.m_TargetSyncRotation3D = rotation; } else { this.m_TargetSyncPosition = reader.ReadVector3(); if (this.syncRotationAxis == NetworkTransform.AxisSyncMode.None) { return; } this.m_TargetSyncRotation3D = NetworkTransform.UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression); } }