Bounbind Box Collision Responce

Started by
2 comments, last by jeppa 20 years, 10 months ago
Anyone know the way to make responce when a AABB collide with some polygons?? Thanks in Advance
Advertisement
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);           }        }    }};  

Everything is better with Metal.

thanks for your reply.but when my (bounding box)camera
collide with world,I need of the responce for sliding
effect.(LIKE quake3 half-life...)..


Thanks

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
http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement