How to increase collision detection radius without adding sensor body

Posts that don't fit into other categories.
asantoso
Posts: 14
Joined: Thu Mar 02, 2017 12:18 am

How to increase collision detection radius without adding sensor body

Postby asantoso » Thu Mar 01, 2018 7:17 pm

I would like to detect collisions outside of the fixture body (imagine tower defense game use case).
One way is to add sensor body fixed on top of the regular visible body (tower), but I don't like this solution.
Is there a way to change detection radius overriding the fixtures rotation disc radius?

William
Site Admin
Posts: 378
Joined: Sat Feb 06, 2010 10:23 pm

Re: How to increase collision detection radius without adding sensor body

Postby William » Fri Mar 02, 2018 8:16 am

The rotation disc radius is used internally for CCD so you wouldn't want to change that.

Have you considered making the tower itself just a larger body (circle, spanning the size you want) and just render it smaller than it really is?

Naturally, doing a sensor is another way.

Another way would be to call a World.detect() method every frame for every tower. Not a bad option, it will use the broadphase to accelerate.

There are probably some other ways too that I'm just not thinking about right now.

Thanks,
William


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests