box2d. Mousejoint with overlapping b2bodies
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.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
精彩评论