Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


AABB-AABB collision normal ( SOLVED )


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 xynapse   Members   -  Reputation: 151

Like
0Likes
Like

Posted 08 September 2012 - 02:36 PM

Ok, i don't think i will ever invent that so i better ask before spending another days looking for something related to the problem...
SOLUTION FOUND HERE: http://www.gamedev.net/topic/567310-platform-game-collision-detection/


My game uses AABB's for collision detection, and i check objects for collision with:

[source lang="cpp"]int CBoundingBox::classify(const CBoundingBox& rOther){ if( rOther.min.x >= min.x && rOther.max.x <= max.x && rOther.min.y >= min.y && rOther.max.y <= max.y && rOther.min.z >= min.z && rOther.max.z <= max.z ) { return INSIDE; } if( max.x < rOther.min.x || min.x > rOther.max.x ) return OUTSIDE; if( max.y < rOther.min.y || min.y > rOther.max.y ) return OUTSIDE; if( max.z < rOther.min.z || min.z > rOther.max.z ) return OUTSIDE; return INTERSECTS; }CVector3 CBoundingBox::closestPointOn(const CVector3& vPoint){ CVector3 xClosestPoint; xClosestPoint.x = (vPoint.x < min.x)? min.x : (vPoint.x > max.x)? max.x : vPoint.x; xClosestPoint.y = (vPoint.y < min.y)? min.y : (vPoint.y > max.y)? max.y : vPoint.y; xClosestPoint.z = (vPoint.z < min.z)? min.z : (vPoint.z > max.z)? max.z : vPoint.z; return xClosestPoint;}bool CBoundingBox::hasCollided(const CBoundingBox& rOther) const{ if( min.x > rOther.max.x ) return false; if( max.x < rOther.min.x ) return false; if( min.y > rOther.max.y ) return false; if( max.y < rOther.min.y ) return false; if( min.z > rOther.max.z ) return false; if( max.z < rOther.min.z ) return false; return true;}[/source]

That works perfectly fine but i need to implement sliding with AABB's so i will need to find out collision normal between AABB1 colliding with AABB2.


Can somebody *please* help me out with this and show me how do i calculate a collision normal between two AABBs ( the normal of the face of the AABB that the player is colliding with ) / find colliding AABB faces ?

Edited by xynapse, 08 September 2012 - 03:43 PM.

perfection.is.the.key

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS