Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

AABB-AABB collision normal ( SOLVED )

4: Adsense

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   

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




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.