private static void ParseNetworkTransfrom(NetworkMessage msg) { NetworkMessage.UpdateTransformMessage transformMessage = (NetworkMessage.UpdateTransformMessage)msg; NetworkEntity entity = null; try { entity = objectRegistryCallback(transformMessage.objectId); } catch (EntityNotFoundException e) { Debug.LogWarning("Unable to update transform of network entity with id " + transformMessage.objectId.id); return; } finally { Debug.Log("In finally"); NetworkTransform netTransform = entity.GetComponent <NetworkTransform>(); if (netTransform != null) { netTransform.ReceiveTransformUpdate(transformMessage.relayPosition.Value, transformMessage.relayRotation.Value, transformMessage.childRelayPosition.Value, transformMessage.childRelayRotation.Value, transformMessage.relayVelocity.Value); } } }
public void InvokePositionUpdate() { if (ClientStage.active && !myNetworkEntity.IsLocalObject()) { return; } NetworkMessage.UpdateTransformMessage transformMsg = new NetworkMessage.UpdateTransformMessage(myNetworkEntity.instanceId, transform.position, transform.rotation, childTransform.localPosition, childTransform.rotation, _velocity); if (ClientStage.active) { ClientStage.SendNetworkMessage(transformMsg); } if (ServerStage.active) { ServerStage.SendNetworkMessage(transformMsg); } previousPosition = transform.position; previousRotation = transform.rotation; previousChildPosition = childTransform.localPosition; previousChildRotation = childTransform.rotation; }