-1
\$\begingroup\$

My player keeps sinking into objects when in right angle and when going to right way. It is hard to explain so I uploaded video about it on youtube. I am using min and max points to detect collision.

if(minX1 <= maxX2 && maxX1 >= minX2 && minY1 <= maxY2 && maxY1 >= minY2 && minZ1 <= maxZ2 && maxZ1 >= minZ2) {

        return true;

}

That code should be fine but somehow it doesn't work with my other stuff. Is there better easy way that I could detect collision using min and max points?

I am checking collision on every update.

\$\endgroup\$
4
  • \$\begingroup\$ You can't ask about two things in a single question post. I suggest you edit this question and remove the second question, and then create a new question post about it. Also, "how do they do it" is off-topic for this site. However, you can ask "How could I avoid this in my project?", which would be on topic. \$\endgroup\$
    – Vaillancourt
    Feb 19, 2017 at 4:01
  • \$\begingroup\$ You probably move the character, and only then check for collision \$\endgroup\$
    – Bálint
    Feb 19, 2017 at 10:41
  • \$\begingroup\$ You are computing collision between AABBs, but are you updating them correctly ? (Are you updating them at all ?). The AABB of an object changes when you rotate it. \$\endgroup\$
    – cmourglia
    Feb 19, 2017 at 14:17
  • \$\begingroup\$ Voting to close this question because it was answered on SO and user hasn't accepted an answer here - and likely never will (one-hit wonder). \$\endgroup\$
    – Engineer
    Feb 20, 2018 at 8:26

1 Answer 1

-1
\$\begingroup\$

I can't answer to you because I wasn't logged in while posting this. I am updating all bounding boxes on every update as you see it is working fine (except that one thing). And yes I use rotation matrix to calculate new min and max after rotation.

Please use https://stackoverflow.com/questions/42325860/3d-bounding-box-not-working-always and go ahead and delete this.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .