/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/bf95c2cbc703123e08ab54e3ceccdd47e48d224a/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h#L3074 /// </summary> public FRepMovement SerializeRepMovement( VectorQuantization locationQuantizationLevel = VectorQuantization.RoundTwoDecimals, RotatorQuantization rotationQuantizationLevel = RotatorQuantization.ByteComponents, VectorQuantization velocityQuantizationLevel = VectorQuantization.RoundWholeNumber) { var repMovement = new FRepMovement(); var flags = ReadBits(2); repMovement.bSimulatedPhysicSleep = flags[0]; repMovement.bRepPhysics = flags[1]; repMovement.Location = SerializeQuantizedVector(locationQuantizationLevel); switch (rotationQuantizationLevel) { case RotatorQuantization.ByteComponents: repMovement.Rotation = ReadRotation(); break; case RotatorQuantization.ShortComponents: repMovement.Rotation = ReadRotationShort(); break; } repMovement.LinearVelocity = SerializeQuantizedVector(velocityQuantizationLevel); if (repMovement.bRepPhysics) { repMovement.AngularVelocity = SerializeQuantizedVector(velocityQuantizationLevel); } return(repMovement); }
public RepMovementAttribute( VectorQuantization locationQuantizationLevel = VectorQuantization.RoundTwoDecimals, RotatorQuantization rotationQuantizationLevel = RotatorQuantization.ByteComponents, VectorQuantization velocityQuantizationLevel = VectorQuantization.RoundWholeNumber) { LocationQuantizationLevel = locationQuantizationLevel; VelocityQuantizationLevel = velocityQuantizationLevel; RotationQuantizationLevel = rotationQuantizationLevel; }
public void RepMovementTest(byte[] rawData, int bitCount, VectorQuantization locationQuantizationLevel = VectorQuantization.RoundTwoDecimals, RotatorQuantization rotationQuantizationLevel = RotatorQuantization.ByteComponents, VectorQuantization velocityQuantizationLevel = VectorQuantization.RoundWholeNumber) { var reader = new NetBitReader(rawData, bitCount); reader.SerializeRepMovement(locationQuantizationLevel, rotationQuantizationLevel, velocityQuantizationLevel); Assert.False(reader.IsError); Assert.True(reader.AtEnd()); }
/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/bf95c2cbc703123e08ab54e3ceccdd47e48d224a/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h#L3074 /// </summary> public FRepMovement SerializeRepMovement( VectorQuantization locationQuantizationLevel = VectorQuantization.RoundTwoDecimals, RotatorQuantization rotationQuantizationLevel = RotatorQuantization.ByteComponents, VectorQuantization velocityQuantizationLevel = VectorQuantization.RoundWholeNumber) { var repMovement = new FRepMovement { bSimulatedPhysicSleep = ReadBit(), bRepPhysics = ReadBit(), Location = SerializePropertyQuantizedVector(locationQuantizationLevel), Rotation = rotationQuantizationLevel == RotatorQuantization.ByteComponents ? ReadRotation() : ReadRotationShort(), LinearVelocity = SerializePropertyQuantizedVector(velocityQuantizationLevel) }; if (repMovement.bRepPhysics) { repMovement.AngularVelocity = SerializePropertyQuantizedVector(velocityQuantizationLevel); } return(repMovement); }