Constraint 2D-polygon based collision

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

Recommended Posts

Hello, In order to deal with my problem, here are some interesting tutorials : http://www.harveycartel.org/metanet/tutorials/tutorialA.html http://www.gamedev.net/community/forums/topic.asp?topic_id=251638 (this link leads to http://uk.geocities.com/olivier_rebellion/Polycolly.zip) Now, here is the topic : I have some problems with a model of constraint 2D-polygon based collision. The main problem consists in deoverlapping two polygons that have collided too deeply to rebound according to the good direction vector, because of a too huge speed for instance. Let's say I have 2 squares of side length = a, the first centered in (0,0) and the second in (b, b) turned with an angle of pi/4, where a/2 < b < a. I want to make the turned one to move according a constraint direction (his speed, let's say), i.e. I want only (cos_theta, sin_theta), and not only the direction of angle theta that gives the choice of both this vector and its opposite : I want the turned square to move in the way that I decided. The basic method of axis separation for collision response gives me the minimum overlap (in the example, it's equal to b on the axis of direction (1, 1)) and the minimum translation vector (in the example, (b/sqrt(2), b/sqrt(2))). But what if I want to make the turned square to move in the other way, according to (-1, -1), for instance, if the (relative) speed is equal to (-1/sqrt(2), -1/sqrt(2)) ? What kind of distance should I use so as to replace the minimum overlap ? Thanks for any response, Amaury H.

Share on other sites
Can you draw a picture? :) I'm a bit confused.

Share on other sites
Hello,

you're right, it's easier to understand with a picture :)

Thanks,

Amaury_H

[Edited by - Amaury_H on April 4, 2008 9:14:07 AM]

Share on other sites
Some precisions : with the first direction to move, it suffices to take the projection of the minimum translation vector onto the (unitarian) direction vector to have the "deoverlapping" translation vector in the direction we want. But in the case of the second direction, you can't take the minimum translation vector defined by the minimum overlap such as the axis separation method told us to do.
I'd like a method to directly calculate the "deoverlapping" translation vector in the direction that I want.

Thanks for all suggestions,

Amaury_H

Share on other sites
picture not working.

One thing I did try, once I get the contact points calculated, is to raytrace from the contact point into the direction I want, and into the other shape. I used that for smoother sliding motion on a triangle soup (or polyline in 2D).

Share on other sites
Hello,

For the picture, let's try this :

About the raytracing, I merely use a kind of method such as it, with dichotomy on the direction, but I'd just like a more "strong" and formula-like method that would ensure me the "formal" translation vector (not only an approximation).

Thanks,

Amaury_H

Share on other sites
in that case, if you perform the swept test only, you will get a negative value for the time of collision (which is why I do not allow this and perform an intersection isntead), and that will tell you how much you have to push the box back. Basically, dont perform a MTD test, just work in swept only and the axis of collision will be the direction you seek, as well as the time of collision.

BTW, I'm tired of that old code (the polycolly demoes), so I'm updating it and cutting the fat out. :) Should back in tomorrow.

[Edited by - oliii on April 4, 2008 6:24:23 PM]

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 14
• 14
• 9
• Forum Statistics

• Total Topics
633374
• Total Posts
3011552
• Who's Online (See full list)

There are no registered users currently online

×