# Catching edge on edge penetration.

## Recommended Posts

Grain    500
This is really baffling me, I can’t seem to find any thing on it online and can’t think of any way of doing it on my own. Let’s say you have two really long objects like sticks and you are smacking them together, or imagine clashing swords. if their velocities are high enough they can pass straight through each other and never touch, and what about angular motion lets say you are putting a stick it to the spokes of a fast spinning wheel. How can you find the point of collisions and collision time in such situations where edges are meeting edges? With vertices I can draw a vector from its old position to its new position to see if it has passed through an object. But there is no logical equivalent when dealing with edges on edges when the vertices can completely miss the other object.

##### Share on other sites
joanusdmentia    1060
It sounds like what you're after is called swept collisions. That is, you 'sweep' the object across it's linear path in the required time interval. You can try googling for that. In the case of a line the swept shape would be a quad, you could then test for collisions using that.

Another option (although not as robust) is to just reduce your collision time step and do multiple collision tests per frame. As a really simple example, you might do the following each frame:

for(int i=0 ; i<10 ; ++i){    // Update object position    object1.MoveBy(object1.velocity*dt/(float)i);    object2.MoveBy(object2.velocity*dt/(float)i);    // Collision test    bool colliding = object1.TestCollision(object2);    if(colliding) do stuff}

##### Share on other sites
d000hg    1199
Or if you don't just want to always run at very small timesteps, you could see if the lines are on 'different sides' of each other before/after the frame. If so, then re-test using smaller timesteps to see if there is a collision.

##### Share on other sites
Guest Anonymous Poster
Quote:
 Original post by d000hgOr if you don't just want to always run at very small timesteps, you could see if the lines are on 'different sides' of each other before/after the frame. If so, then re-test using smaller timesteps to see if there is a collision.
Could you elaborate one that. How do you test for 'different sides’ of a line.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account