1
\$\begingroup\$

I'm working on a dungeon generation script and I'm having some issues detecting overlap. Each piece that I spawn has attachment points, with rotation values and an offset amount so things lineup correctly. So far this is working. After spawning, I then check to see if the piece is overlapping with another, but sometimes it seems like unity hasn't caught up with the collision system, as I check to see if a bool bOverlap is true(which gets set in an ontriggerstay function) and if so destroy the piece. However, many times the script will have gotten past this collision check portion, before the collision event fires.

Any suggestions?

Each piece has a rigidbody and box collider on it for the simple collisions.

\$\endgroup\$
2
  • \$\begingroup\$ Can you post the relevant part of the code? Where do you spawn each object and how do you move it to the relevant position? I'm confused why you need to check for collision, if you've already figured out attachment points and rotation. \$\endgroup\$ Commented May 11, 2019 at 9:50
  • \$\begingroup\$ Have you tried checking for overlap before you spawn, with Physics.OverlapBox? \$\endgroup\$ Commented May 11, 2019 at 12:41

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.