feature: Add NoRotation to NetworkTransform (#616)

This allows you to leave rotation out of the NetworkTransform if you only need position.
Right now if you don't need sync rotation and set compression to Lots, it can move your object in ways not expected. This forces you to use no compression as a fix. Using more bandwidth for something you don't need. I think this is all that is needed, tested it in my game and it works.
This commit is contained in:
Anthony Eckert 2019-03-20 00:46:33 -04:00 committed by Paul Pacheco
parent 65a136b938
commit 00961ccc9c

View File

@ -30,7 +30,7 @@ public abstract class NetworkTransformBase : NetworkBehaviour
// but would cause errors immediately and be pretty obvious.
[Tooltip("Compresses 16 Byte Quaternion into None=12, Much=3, Lots=2 Byte")]
[SerializeField] Compression compressRotation = Compression.Much;
public enum Compression { None, Much, Lots }; // easily understandable and funny
public enum Compression { None, Much, Lots , NoRotation }; // easily understandable and funny
// server
Vector3 lastPosition;
@ -312,8 +312,11 @@ bool HasMovedOrRotated()
void ApplyPositionAndRotation(Vector3 position, Quaternion rotation)
{
targetComponent.transform.position = position;
if (Compression.NoRotation != compressRotation)
{
targetComponent.transform.rotation = rotation;
}
}
void Update()
{