Original Post
🔒 Locked
Collision response problem
Advertisement
Perhaps show some code or give a little more detail? I''ve recently done something similar so I might be able to help.
Here''s the code I have for my collision resolution.
Then do collision test again and resolution if necessary. I found that to work really well and it''s simple. Hopefully that helps some?
Here''s the code I have for my collision resolution.
// Find depth of penetration
float depth = m_fRadius - Util::PointToPlaneDist( pn, &m_vPos ); // pn is a PointNormal object for the plane I''m testing (simple demo in a cube room)
// Scale normal by depth of penetration
D3DXVECTOR3 vec = pn->vNormal;
vec *= depth;
// Move along the normal and it should put us right at the edge of the wall so we can slide
m_vPos -= vec;
Then do collision test again and resolution if necessary. I found that to work really well and it''s simple. Hopefully that helps some?
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement