[ODE] dGeomRaySet doesn't work correctly?

Roland Kindermann iyo at gmx.de
Fri Sep 15 08:01:10 MST 2006

here is my code:

Ogre::Vector3 diff = dest - pos;
dGeomRaySet(mRay, pos.x, pos.y, pos.z, diff.x, diff.y, diff.z);

pos is the starting position of the ray and dest is a point through wich 
the ray will go. Looks to me as if you do pretty much the same. Are you 
sure that vector is normalised and you set the ray length long enough? 
Maybe it's important to set the ray length before calling dGeomRaySet?
Maybe it helps if you send an entire code section.
Roland Kindermann

michael kapelko schrieb:
> I get position of target body, get position of a camera. Then I create 
> vector = body_pos - cam_pos. Then I normalize it (make it of unit 
> length). Then I do dGeomRaySet (gun_ray, cam_pos.X, cam_pos.Y, 
> cam_pos.Z, vector.X, vector.Y, vector.Z) and get no ray-box collision! 
> How's that possible? When I do only dGeomRaySet (gun_ray, cam_pos.X, 
> cam_pos.Y, cam_pos.Z, 0, -1, 0), that is, make the ray come from camera 
> to the ground, collision occurs when I move above boxes! But it doesn't 
> work for arbitrary ray direction I'm trying to set. What am I doing 
> wrong? Can someone show me the code with aligning a ray along camera 
> view vector?
> Thanks.
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode

More information about the ODE mailing list