Jump to content

Collision problems


Recommended Posts



I have a problem with collision.


I am using game.physics.overlap to check collisions between two groups. I do not need to simulate the objects colliding, just check if they are overlapping.


This works fine, however after I detect an overlap, I call kill on the object. This is where problems start to occur.


The object "dies" IE is no longer set to exist, visible, or alive. Then, when I want to recycle the object I call getFirstExist() on the group.


This returns the object, however, no matter what I do to the position of the object it will always collide at the position it died at.


For example, say two objects hit, and one dies. If I recycle the dead object and completely change it's position before it can move to that position the collision of where it was is processed and it will immediately die, never appear. If I stop processing collisions, it will behave as expected (go to the position I told it to)


Nothing I do fixes the problem. I tried seperating the objects by changing their x and y values before calling kill, and tried changing the bodies x and y values too. Nothing I have tried stops this issue. Is this intended behavior? Am I supposed to check for collisions somewhere that isn't the update loop? Any help is appreciated.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...