Sign in to follow this  

Two+ Planes - Circle Sweep

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, my first post to this very helpful forum. I’m a final year high school student in Australia working on my major software project, which is a top-down multiplayer tank game. Let me just say my choice was both great and stupid - I’ve learnt so much, but I really didn’t realise how incredibly difficult this is going to be, especially the multiplayer component. What a nightmare. Thankfully that’s all finished now, and I would appreciate your help greatly with the following problem (ignore the red circles, purple lines, green line etc) http://img90.imageshack.us/my.php?image=tank1eo.jpg Basically Ive got a tank, and two walls (planes) My implementation of the following algorithm for plane-sphere sweep testing is rock solid (http://www.gamasutra.com/features/19991018/Gomez_1.htm), but only when its with one wall at a time. The problem arises when two walls are involved at the same time, the tank (when at angles to one of the walls) can 'slide through' the adjacent wall. Here what I think is happening - - it collides with one wall first, and is correctly placed. This happens to be on another side of the adjacent wall - soon after that adjacent wall is tested and a collision is detected as the tank has passed through the wall. The tank is correctly collided with this wall, which then places it back in the original position on the other side of the first wall since that first wall has already been tested, it is not placed back. Is that it? Is it something else? Either way, how can I fix it? Thank you for your help in this perhaps trivial problem, but unfortunately I lack the experience to solve it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mumma
Hello, my first post to this very helpful forum.
Welcome :-)

The type of collision detection and response you're using is usually performed recursively, following roughly these steps:

1. Test moving object against all potential colliders
2. If there are any collisions, take the first one (with the smallest time value)
3. Move the object to the time of collision (usually minus an epsilon)
4. Restrict the velocity vector so that it is parallel to the collider, and...
5. Subtract the 'used up' time from the total time
6. Rinse and repeat until all time is used up or there is no collision

This is how it's done in pretty much all FPS-type games such as Quake, Unreal, and so on. This method is pretty well documented; you can find a good description here, among other places.

Although conceptually straightforward, the algorithm can sometimes require a fair amount of tweaking to make it robust and consistent; problems can include jittering, getting stuck, or falling through (even with the recursive test). There are different ways to address the robustness problem; the solution I used was to run a discrete collision test and resolution step after the swept test, to make sure the object was non-intersecting at the beginning of each update. I stress-tested my implementation with difficult geometry and at extremely high velocities, and never had any jittering, getting stuck, or falling through. To be fair though, sometimes you have to run your simulation for hours to find that one case where it fails; in short, implementing production-quality collision detection and response is hard.

One more thought. I'm guessing your tanks don't move too quickly, in which case a simple discrete-only test might suffice. It would give the same sliding response, while being more robust and much easier to code and debug than the swept test. Just a thought.

Share this post


Link to post
Share on other sites
Interesting, I was thinking of some sort of recursive thing but I wasnt entirely sure on what exactly I was supposed to do. I have a fair idea on what you described, so ill attempt to implement it. Thank you for the help, ill prolly be back soon ;P

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this