Fixes #14220
Because the entity they start following is moving, the physics system gives the follower opposing velocity to counteract, at the time the parent change happens. This happens *after* the follower system tries to clear the follower's velocity, so the follower gets some velocity that will still move them a bit off-center.
Fix is easy enough, just reset velocity *after* reparenting, not before.
if (TryComp<JointComponent>(follower, out var joints))
_jointSystem.ClearJoints(follower, joints);
- _physicsSystem.SetLinearVelocity(follower, Vector2.Zero);
-
var xform = Transform(follower);
_containerSystem.AttachParentToContainerOrGrid((follower, xform));
_transform.SetCoordinates(follower, xform, new EntityCoordinates(entity, Vector2.Zero), rotation: Angle.Zero);
}
+ _physicsSystem.SetLinearVelocity(follower, Vector2.Zero);
+
EnsureComp<OrbitVisualsComponent>(follower);
var followerEv = new StartedFollowingEntityEvent(entity, follower);