Collision 'Correction'
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 ~
I'm not the brightest something or other in a group or similar.~ me ~
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
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
- Jeff Johnson"He who questions training, only trains himself at asking questions" - Sphynx
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
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
I'm not the brightest something or other in a group or similar.~ me ~
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement