Sync character collider rotation, try to make collider face the main limb by instantly flipping it if the angle's too wide, client-side ragdoll correction is more aggressive

This commit is contained in:
juanjp600
2017-12-12 17:58:49 -03:00
parent 7ce93d2e1f
commit 23b220b6af
6 changed files with 41 additions and 22 deletions
@@ -138,11 +138,12 @@ namespace Barotrauma
msg.ReadFloat(),
msg.ReadFloat());
float rotation = msg.ReadFloat();
int index = 0;
if (GameMain.NetworkMember.Character == this && AllowInput)
{
var posInfo = new CharacterStateInfo(pos, networkUpdateID, facingRight ? Direction.Right : Direction.Left, selectedEntity, animation);
var posInfo = new CharacterStateInfo(pos, rotation, networkUpdateID, facingRight ? Direction.Right : Direction.Left, selectedEntity, animation);
while (index < memState.Count && NetIdUtils.IdMoreRecent(posInfo.ID, memState[index].ID))
index++;
@@ -150,7 +151,7 @@ namespace Barotrauma
}
else
{
var posInfo = new CharacterStateInfo(pos, sendingTime, facingRight ? Direction.Right : Direction.Left, selectedEntity, animation);
var posInfo = new CharacterStateInfo(pos, rotation, sendingTime, facingRight ? Direction.Right : Direction.Left, selectedEntity, animation);
while (index < memState.Count && posInfo.Timestamp > memState[index].Timestamp)
index++;