I've been writing down some ideas for my collision/response process and I've come up with the following.
- Quadtree/Octree tests all pairwise collisions (Object 'A' vs Object 'B')
- If the time of collision is soonest for both 'A' AND 'B' then store contact in a list, otherwise don't store the contact data
- For each contact data stored in the list, 'A' reacts to collision and 'B' reacts to collision
I've come unstuck when it comes to overwriting contact data stored in the list though and would like some help. Because the closest time is always stored, how can I overwrite the current closest contact time if one of the objects hits another object sooner in a later pairwise test?
E.g.
'A' collides with 'B' at time 0.8, collision data for the pair is stored in a list.
In a later pairwise test during the same frame 'A' collides with 'C' at time 0.4.
Now the entry for 'A' and 'B' must be erased and replaced with 'A' and 'C'.
Is my idea for the collision process sound in your view?
Thank you.
[C#] Overwriting entries in a list based on classes.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement