Fix network animator doesn't sync float value as expected (#589)

Maybe we should do float sync when the Abs of newValue - lastValue > 0.001f
This commit is contained in:
Liu 2019-03-13 19:15:34 +08:00 committed by vis2k
parent b0ef89a0d9
commit dea7b58792

View File

@ -230,7 +230,7 @@ bool WriteParameters(NetworkWriter writer, bool autoSend)
else if (par.type == AnimatorControllerParameterType.Float) else if (par.type == AnimatorControllerParameterType.Float)
{ {
float newFloatValue = m_Animator.GetFloat(par.nameHash); float newFloatValue = m_Animator.GetFloat(par.nameHash);
if (Mathf.Abs(newFloatValue - lastFloatParameters[i]) < 0.001f) if (Mathf.Abs(newFloatValue - lastFloatParameters[i]) > 0.001f)
{ {
writer.Write(newFloatValue); writer.Write(newFloatValue);
dirtyBits |= 1u << i; dirtyBits |= 1u << i;