Fixed Velocity - Sticking Together
Opened this issue · 4 comments
It appears that in the fixed velocity implementation, ants are getting stuck together. This may be the result of not conserving momentum but using readings from conservation of momentum... perhaps the ants aren't really stuck but they are now headed in the same direction. Definitely worth investigating.
This is probably due to penetration after collision - not necessarily the illusion of sticking together due to heading in the same direction.
Definitely due to penetration during a collision. See how this is handled in the QUORUM_LOADING folder for the solution.
The way to solve this is not by insisting there is no penetration, but rather, but making sure the penetration doesn't affect the next timestep.
The two types of penetration have different solutions:
-
Ant-Ant penetration
The solution to this is to only calculate collision time if the indices for colliding ants have changed since last time. This means that there won't be a collision if the particles have penetrated each other. Two particles can collide twice in a row if and only if there is a wall collision or a separate particle collision in between. -
Ant-Wall Penetration
Unlike Ant-Ant penetration, the same ant can collide with a wall twice in a row in a natural way. Therefore, we can't insist that wall time is calculated if and only if the index of the colliding ant has changed. Instead, we need to move the ant back into the arena PRIOR to calculating wall time. Then wall time will be the natural time for the next wall collision, rather than an extremely short time corresponding to hitting the outside edge of the arena. This is important because the ant is not able to re-enter the arena without this bug fix, since its velocity component will flip and keep it outside the arena.