[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] The Giant - 'cool project I'm working on now' - thread.



The scheme I've been working on is to compute what I call a "shadow", which is the set of all points that would cause a collision if you placed the object there. This is a minkowski sum if you're familiar with that term. Then as the mouse moves, I compute the closest point that doesn't fall in the shadow. So my scheme would handle this case by finding the closest place where the object fits. If you press tab in the demo I sent out earlier it shows the shadow.

--Mike

DR0ID wrote:
Hi

Right, a special case I didnt think off (how often does it apply?). Anyway, it is the collision response that has to handle this. How would you handle this case? Slide it along one of the colliding objects until it 'fits'?

~DR0ID



Michael George schrieb:
I don't think that works. Consider an object smooshed between two others. The collision from the one on the left would have a vector pointing to the right. The collision from the one on the right would have a vector pointing left, and the sum would be zero (unless I'm misunderstanding).

--Mike

DR0ID wrote:
Hi

Well, you can apply the 'axis separating theorem' to a 'multi collision (just test all potential colliding objects). As a result you get the penetration depth as a vector, which you could sum up to get a general direction to move you object (in Murmel I did this, IIRC). But probably you know that already.

~DR0ID

Michael George schrieb:
Thanks for the pointer. That looks like good stuff and I haven't come across it before. I don't think it will apply to my game because of the common case where there's a cluster of objects that you need to respond to, but I will definitely read it through in more detail.

--Mike

DR0ID wrote:
Hi

here is a good tutorial about 2d collision (probably you already know): http://www.harveycartel.org/metanet/tutorials.html