www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: nathan on April 08, 2013, 04:43:32 am

Title: Find the colliding object with world.checkCollisionSphereical()
Post by: nathan on April 08, 2013, 04:43:32 am
The function
Code: [Select]
public int checkCollision(SimpleVector org, SimpleVector dr, float step)returns the id of the object that the collision happens with.  However, the function
Code: [Select]
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()?
Title: Re: Find the colliding object with world.checkCollisionSphereical()
Post by: EgonOlsen on April 08, 2013, 07:28:39 am
Have a look here: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/CollisionListener.html (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/CollisionListener.html)
Title: Re: Find the colliding object with world.checkCollisionSphereical()
Post by: nathan on April 09, 2013, 03:29:04 am
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. 
Title: Re: Find the colliding object with world.checkCollisionSphereical()
Post by: EgonOlsen on April 09, 2013, 07:25:19 am
Yes, you can reuse one instance of the listener for multiple objects.