vrld / HC

General purpose collision detection library for the use with LÖVE.
http://hc.readthedocs.org/
402 stars 48 forks source link

Get edges and vertices of collision #20

Closed benui-dev closed 12 years ago

benui-dev commented 12 years ago

When two objects collide, it would be really useful to know what edges and vertices were part of the collision.

For example when the player hits the ground, you want to stop their y velocity, but not their X velocity.

And to grab onto parts of the wall, you want to know when the sides of the player collide with the corner of a wall. But you don't care when the bottom of the player collides with the corner.

Would this be possible?

vrld commented 12 years ago

It would be possible to get contact information (for example using this method), but I think this might be out of scope. If you need such information you should use love.physics.

Anyway, what you do get is the separating vector, i.e. the path you have to move the shapes so that they don't collide any more. You can use this to determine whether the player hits the ground (x coordinate of the separating vector is [close to] 0) or a wall (y coordinate is [close to] 0).

=> Wontfix