www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: Edak on June 24, 2011, 09:25:10 pm
-
I want to cast a specific ray ( ie I supply origin and direction ) and collect the first point in world-space there was a collision at.
-I've implemented the collision listener to my class.
-I've done this:
public void collision(CollisionEvent ce){
Logger.log("Detected");
new SimpleVector CollisionPoint = ce.getFirstContact();
}
-I've applied Object3D.COLLISION_CHECK_OTHERS to the mesh I want to test.
Now how do I cast a ray from point A to point B and have it trigger the collision event? Thus outputting to the log Detected and setting CollsionPoint
-
The event will be triggered by any collision method as well as by the calcMinDistance-method in World.
-
Thanks but maybe I need to rephrase my question.
I want to cast a ray, what methods can I use?
I want to specify the start, and I want to specify a direction, then I want to get the first place in world space there's a collision detection.
-
I've actually already answered this with my first reply. Maybe the wiki helps: http://www.jpct.net/wiki/index.php/Collision_detection#Ray-Polygon (http://www.jpct.net/wiki/index.php/Collision_detection#Ray-Polygon)
-
Excellent my mistake :-) Thanks.