#### Archived

This topic is now archived and is closed to further replies.

# Bounbind Box Collision Responce

This topic is 5505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Anyone know the way to make responce when a AABB collide with some polygons?? Thanks in Advance

##### Share on other sites
very difficult subject my friend. you''ll need more than a few posts to answer that questions.

I would suggest you constraint the box''s movement with the planes it collidied with.

Constrain the position, velocity and forces. try something like this.

  class CPlanes{    Vector m_Normal;    float  m_d;    void ConstainBox(CAABBox& Box, float fDamping)    {         Vector Support = Box.GetSupportPoint(m_Normal);              float Depth = d - (Support * m_Normal);         if (d < 0.0f)              return;         Box.m_Position += m_Normal * (Depth * fDamping);    }    void ConstainVector(Vector& V)    {        V -= (V * m_Normal) * m_Normal;    }};class CAABBox{    CList<CPlanes> m_Constaints;    Vector m_Position;    Vector m_HalfSize;    Vector m_Velocity;    Vector m_Acceleration;    Vector GetSupportPoint(const Vector& Axis) const    {         Vector V = m_HalfSize;         if (Axis.x > 0.0f) V.x *= -1.0f;         if (Axis.y > 0.0f) V.y *= -1.0f;         if (Axis.z > 0.0f) V.z *= -1.0f;                      V += m_Position;         return V;    }        void ApplyConstaints(void)    {       for(int iter = 0; iter < 10; iter ++)       {           for(int j = 0; j < m_Constaints.Size(); i ++)           {               m_Constraints[i].ConstrainBox(this, 0.1f);               m_Constraints[i].ConstrainVector(m_Velocity);               m_Constraints[i].ConstrainVector(m_Acceleration);           }        }    }};

##### Share on other sites
collide with world,I need of the responce for sliding
effect.(LIKE quake3 half-life...)..

Thanks

##### Share on other sites
look at the articles section about collision detection there s an tutorial over at gamasutra that contains all you need spher ->AABB collision detection + the formulas for all these sliding effects

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631431
• Total Posts
3000039
×