public override bool Write(Connection connection, NetworkObj obj, NetworkStorage storage, Packet packet) { if (obj.RootState.Entity.HasParent) { if (connection.entityChannel.ExistsOnRemote(obj.RootState.Entity.Parent)) { packet.WriteEntity(obj.RootState.Entity.Parent); } else { return(false); } } else { packet.WriteEntity(null); } if (PositionEnabled) { PositionCompression.Pack(packet, storage.Values[obj[this] + POSITION].Vector3); if (Extrapolation.Enabled) { PositionCompression.Pack(packet, storage.Values[obj[this] + VELOCITY].Vector3); } } if (RotationEnabled) { RotationCompression.Pack(packet, storage.Values[obj[this] + ROTATION].Quaternion); } return(true); }
public void Pack(Packet stream, Quaternion value) { if (QuaternionMode) { Quaternion.Pack(stream, value.x); Quaternion.Pack(stream, value.y); Quaternion.Pack(stream, value.z); Quaternion.Pack(stream, value.w); } else { Euler.Pack(stream, value.eulerAngles); } }
public override bool Write(Connection connection, NetworkObj obj, NetworkStorage storage, Packet packet) { Compression.Pack(packet, storage.Values[obj[this]].Vector3); return(true); }