Turn off gravity for dynamic bodies?

Hi,

In working on my game I’ve run into a situation where I need enemies to detect collision with the player but not other enemies. I’ve set it up so that enemies have dynamic body types and are sensors (so they can overlap each other), and turned off gravity so they don’t fall through the world.

Just wondering if there’s a better way to do this because I may need gravity for other things. But as things are I will have to simulate gravity manually. [import]uid: 6259 topic_id: 1549 reply_id: 301549[/import]

Yes, there is a better way! If you basically want certain items to not collide with each other, you should use collision filters, explained here:

http://developer.anscamobile.com/content/game-edition-collision-detection#Collision_categories_masking_and_groups

To see a demonstration, check out the “CollisionFilter” sample project. [import]uid: 3007 topic_id: 1549 reply_id: 4441[/import]