Find the colliding object with world.checkCollisionSphereical()

Started by nathan, April 08, 2013, 04:43:32 AM

Previous topic - Next topic

nathan

The function
public int checkCollision(SimpleVector org, SimpleVector dr, float step)
returns the id of the object that the collision happens with.  However, the function
public SimpleVector checkCollisionSpherical(SimpleVector org, SimpleVector translation, float radius)
does not.  Instead it returns the vector that is safe to translate before the collision happens.

Why is the functionality different?  And is there any way I can check what object I collide with when I use checkCollisionSpherical()?


nathan

So I would put a collision listener on every one of my objects?  It seems that I can use the same instance of the CollisionListener, because the CollisionEvent has targets. 

EgonOlsen

Yes, you can reuse one instance of the listener for multiple objects.