Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Militant

Collision 'Correction'

This topic is 6082 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

I''m not exactly sure how to word this.. In my 2D environment (game), there are sprites controlled by the players (k). All players use the same computer at the same time (4 max), and so they are processed in order of ''id'' (1-4). When players collide they can and usually do overlap and to correct this the player w/ the higher id (1-4, 1 being high) corrects the overlap by ~1/2 leaving the rest to the other player involved. This is so the higher player can''t push the lower around. The player sprites are small and square, incase you wanted to know.. Is there a better way to do this? Maybe I''m starting all wrong? ~ me ~

Share this post


Link to post
Share on other sites
Advertisement
Hello,

Maybe having a way to detect collision for all players first. Like in a matrix
.1234
1-X--
2---X
3X--X
4----

This would mean player 1 & 3 hit each other, 1 & 2 hit each other, 2 & 4 hit each other, and 3 & 4 hit each other. In each of the X's on the chart, you would store the other players original speed, mass, etc. Then when you process them all, you take the original values and apply them to all the collisions. You would have to watch out for overlap still, but you can get around that (I think) by just making sure there are no collisions when you are done with the algorithm. If this made no sense, or you are ready to pull your hair out, let me know.

Jeff

Edited by - JJXtra on February 26, 2002 1:09:21 PM

Edited by - JJXtra on February 26, 2002 1:09:46 PM

Share this post


Link to post
Share on other sites
I got it.. thx for the idea.

I'm still wondering if there was/is a better way to correct the overlapping than letting each player correct 1/2 of the overlap.



Militant - "Education is that which allows us to get into more intelligent trouble"

Edited by - Militant on February 26, 2002 1:43:31 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!