craftworkgames / MonoGame.Extended

Extensions to make MonoGame more awesome
http://www.monogameextended.net/
Other
1.44k stars 325 forks source link

OnCollision are called even after objects involved are moved and not intersecting #795

Closed toore closed 1 year ago

toore commented 2 years ago

Resolve #796

Potentially resolve #591

I changed the algorithm, so that the actual bounds are always used. I don't know if this will cause any unwanted side-effects.

A couple of unit tests were added to prove the case.

florentmontesano commented 1 year ago

I had a similar issue as https://github.com/craftworkgames/MonoGame.Extended/issues/796 and fixed it by moving the value.Bounds = value.Target.Bounds; statement one line below, to put it out of the loop in CollisionComponent#Update.

Your solution is much better since there is no more need to update the actual bounds.

I tested this fix in my game and it looks good.

Please merge! 👍

Gandifil commented 1 year ago

Ok, I have check this solution, and will merge it.

@florentmontesano But, I need fully refactor all code about collision system. Remember, I will rewrite this in next releases.