Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Search
Login
Register
www.jpct.net
»
jPCT-AE - a 3d engine for Android
»
Support
»
Casting Rays for collision Detection
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Casting Rays for collision Detection (Read 3251 times)
Edak
byte
Posts: 14
Casting Rays for collision Detection
«
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
Logged
EgonOlsen
Administrator
quad
Posts: 12297
Re: Casting Rays for collision Detection
«
Reply #1 on:
June 25, 2011, 11:54:25 pm »
The event will be triggered by any collision method as well as by the calcMinDistance-method in World.
Logged
Edak
byte
Posts: 14
Re: Casting Rays for collision Detection
«
Reply #2 on:
June 26, 2011, 12:27:16 am »
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.
Logged
EgonOlsen
Administrator
quad
Posts: 12297
Re: Casting Rays for collision Detection
«
Reply #3 on:
June 26, 2011, 12:30:11 am »
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
Logged
Edak
byte
Posts: 14
Re: Casting Rays for collision Detection
«
Reply #4 on:
June 26, 2011, 12:58:01 am »
Excellent my mistake :-) Thanks.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
www.jpct.net
»
jPCT-AE - a 3d engine for Android
»
Support
»
Casting Rays for collision Detection