Collision System
I''m writing a spherical collision system. I''m testing against surface, edge, and points for each triangle. I''m having a problem determining what type of collision occurs based on the sphere colliding with multiple things.
A simple example, I have a square made out of 4 polygons. Each poly connects at a point in the middle of the square. When the sphere hits near the center, I register 4 or 5 collisions -- a point, a couple edges, a couple surfaces. It just so happens that the point is registered as the nearest collision so I bounce off of that point. Obviously, the entire thing should be treated as just a surface.
The question is how to determine when a point and edge collision are REALLY what I need to collide with (like at a corner) rather than a surface collision. I''ve tried a couple different things like dealing with every collision as if it were a surface but the sphere would fall through edges at times (like at steps, or ledges) because of this.
There''s got to be a fairly simple solution to this. I think I''m just looking at it too literally when I''m thinking of each type of collision.
Maybe I need to do some sort of preprocessing to throw out invalid collisions (like the middle point, and every internal edge in the example above)?
Does anyone know of an easy way to deal with this?
it''s a tricky subject, especially when the sphere is deeply embedded into the geometry. I hacked it in a collision system by filtering the collisions as they occurs.
Say a point collision occurs, but there was already a triangle-plane collision, and the point belong to the triangle. In that case, I''ll throw away the point collision. Same for an edge. If a triangle plane has the edge, and the triangle plane already collided, throw away the edge collision. ect... By filtering like that, you throw away a fair amount of collisions, but it''s far from perfect. It works OK if the sphere is not too embedded.
The best way to detect collisions is to introduce linear velocities. Then, you only process one contact at a time, to the expense of running the algoritm several times per frame, and with tricky special cases when the velocity is 0.
If anyone as a good algorithm for interference detection, I''m all ears too.
Say a point collision occurs, but there was already a triangle-plane collision, and the point belong to the triangle. In that case, I''ll throw away the point collision. Same for an edge. If a triangle plane has the edge, and the triangle plane already collided, throw away the edge collision. ect... By filtering like that, you throw away a fair amount of collisions, but it''s far from perfect. It works OK if the sphere is not too embedded.
The best way to detect collisions is to introduce linear velocities. Then, you only process one contact at a time, to the expense of running the algoritm several times per frame, and with tricky special cases when the velocity is 0.
If anyone as a good algorithm for interference detection, I''m all ears too.
Everything is better with Metal.
I''m collecting all the collisions for a specific timestep and then try to determine the collision from that. So, I could remove any points/edges if they''re part of a poly that also had a surface collision. I''ve tried evaluating the collisions I''ve collected in similar ways but, like you said, it''s far from perfect.
There''s gotta be a fairly straightforward way to determine actual collisions -- I just can''t think of it. Certainly someone here has dealt with this issue.
There''s gotta be a fairly straightforward way to determine actual collisions -- I just can''t think of it. Certainly someone here has dealt with this issue.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement