Test collision before adding new Body

Posts that don't fit into other categories.
assofohdz
Posts: 25
Joined: Mon Apr 17, 2017 10:46 am

Test collision before adding new Body

Postby assofohdz » Fri Aug 11, 2017 1:54 am

Hi

Before I add a body to the world I would like to check if that action would result in collisions. Is there a sensible way to do that? (this is in regards to placing towers in a tower defense game, I would like to check if the new tower would overlap with any existing towers)

Kind regards

zoom
Posts: 139
Joined: Sun Mar 17, 2013 3:57 pm
Location: Stockholm, Sweden
Contact:

Re: Test collision before adding new Body

Postby zoom » Fri Aug 11, 2017 2:27 am

You can use the family of 'detect' methotds on the world.

http://docs.dyn4j.org/v3.2.4/org/dyn4j/ ... util.List-

assofohdz
Posts: 25
Joined: Mon Apr 17, 2017 10:46 am

Re: Test collision before adding new Body

Postby assofohdz » Fri Aug 11, 2017 2:38 am

Thank you. Exactly what I was looking for :

Code: Select all

public boolean detect(Convex convex,
                      java.util.List<DetectResult> results)


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest