Skip to content

Commit a6468d3

Browse files
Merge pull request #1010 from vyachkoslav/fix-removeforces
fix: RemoveForces removing MoveRotation and MovePosition
2 parents bd351ab + 7849024 commit a6468d3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Assets/FishNet/Runtime/Object/Prediction/PredictionRigidbody.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,11 +484,12 @@ private void RemoveForces(bool nonAngular)
484484
if (_pendingForces.Count > 0)
485485
{
486486
ForceApplicationType velocityApplicationTypes = ForceApplicationType.AddRelativeForce | ForceApplicationType.AddForce | ForceApplicationType.AddExplosiveForce;
487+
ForceApplicationType nonVelocityTypes = ForceApplicationType.MovePosition | ForceApplicationType.MoveRotation;
487488

488489
List<EntryData> newDatas = CollectionCaches<EntryData>.RetrieveList();
489490
foreach (EntryData item in _pendingForces)
490491
{
491-
if (VelocityApplicationTypesContains(item.Type) == !nonAngular)
492+
if (TypesContain(velocityApplicationTypes, item.Type) == !nonAngular || TypesContain(nonVelocityTypes, item.Type))
492493
newDatas.Add(item);
493494
}
494495
// Add back to _pendingForces if changed.
@@ -500,9 +501,9 @@ private void RemoveForces(bool nonAngular)
500501
}
501502
CollectionCaches<EntryData>.Store(newDatas);
502503

503-
bool VelocityApplicationTypesContains(ForceApplicationType apt)
504+
static bool TypesContain(ForceApplicationType types, ForceApplicationType apt)
504505
{
505-
return (velocityApplicationTypes & apt) == apt;
506+
return (types & apt) == apt;
506507
}
507508
}
508509
}

0 commit comments

Comments
 (0)