Casting Rays for collision Detection

Started by Edak, June 24, 2011, 09:25:10 PM

Previous topic - Next topic

Edak

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

EgonOlsen

The event will be triggered by any collision method as well as by the calcMinDistance-method in World.

Edak

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.

EgonOlsen


Edak