Reputation: 2796
Hey, i'm using a mousejoint for my b2world to move objects around.
I have two objects. a Hero and an Enemy each with their own b2bodies.
The mousejoint works if I click on the hero, but I intentionally made my mousejoint method break if I click on the enemy. In that, so you cannot move the enemy intentionally.
I have also allocated filter index's for both of these objects so that they cannot collide.
The problem i'm facing is, when the Enemy and the Hero touch eachother, they begin to overlap and once they overlap, the mousejoint doesnt work as I intentially wanted. I can no longer click on the Hero object.
Please help me with this.
Thank you
Oliver.
Upvotes: 0
Views: 294
Reputation: 24846
Add some extra condition when your are searching the overlapped by your finger b2Bodies. For example put all of the overlapped bodies in the std::list and then iterate over the list to find your Hero. If there is no Hero select anything you want from the list
Upvotes: 1