xna - Collision Handling Between Circle and Line Segments -


I am implementing a small game and I am having difficulty working physics properly. In this game, a ball (a circle that runs from frame to frame, can change radius) and many walls (line segments, which change from frames to frame and increase) I properly detected the collision I can not, and there is no problem bouncing the ball in the right direction.

In such situations, by piercing a line in one frame by piercing the balls, then again it takes a hole in the later frame, due to a double bounce, I can take the ball back with normal Unless it is in a valid state, but it is actually a cause of weird behavior when the line in question is being hit with its axis (a ping pong ball is an honest toothpaste suddenly abruptly toothpick Moving aside one side ...) There are also some issues when the ball holes more than one line in a given frame (the idea of ​​making a rectangle with four rows together with the rectangular corner gaps Do) - In what direction should it bounce? In which direction should this change?

I do not really have a specific question, but looking for tips or some useful tutorials. <2 p>

Thank you, Cameron

This is a universal problem with most physics libraries. If you want Google for "depth of entry" (simultaneous "physics", I suggest, or you get something completely different You may find that these libraries also use moves like yours.

The solution is to:

To increase your updated frequency, move the object to 10 small steps instead of one big space and you will have less penetration, so the ball Removing it from the wall will make it less visible.

Expanding an ongoing collision is an algorithm that can tell you, given a dynamic and steady object, the precise point in time will both intersect. To find some of these, Google "region rectangular intersection is flowing"

You can then update like this: Check the ball 1.0 units collision, after the collision 0.25 units, then move the ball through 0.25 units, calculate the vector with the image (so that Repeat the check of the collision with the ball bounced from the wall), remaining 0.75 units (unless you do not know the final position of the ball). It completely avoids the hives and even if your ball is moving so fast that it can usually go to the wall in the same update, the collision will be detected.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -