[ODE] Implementing a pick. worked in 0.39 but not in 0.5

Hampus Soderstrom hampus at sxp.se
Thu Feb 17 01:21:55 MST 2005


Thanks Geoff,

Normalizing did the job.

cheers

/Hampa

2005-02-15 kl. 11.25 skrev Geoff Carlton:

> This is a bit of a stab in the dark (so to speak), but perhaps the ray 
> code now assumes the direction is normalised?   Try normalising the 
> (end-start) direction vector before passing it into RaySet(..).
>
> Geoff
>
>
> Hampus Soderstrom wrote:
>
>> Hi,
>>
>> Could it be some problem with ray and spheres colliding?
>>
>> When I changed all my bodies  to boxes and cylinders it workes just 
>> fine.
>>
>> cheers
>>
>> Hampa
>> SXP
>>
>> 2005-02-14 kl. 18.05 skrev Hampus Soderstrom:
>>
>>> Hi,
>>>
>>> I have the following code in response to a mouse click:
>>>
>>> It worked in 0.39 but now that I have upgraded to 0.5 my ray 
>>> collides with alot of bodies.
>>>
>>> If I draw out the ray it has the correct length and direction.
>>>
>>> This is my picking code:
>>>
>>> //print out what body user clicked on
>>> static void pick(float start[3], float end[3]){
>>>
>>>         dGeomID g = NULL;
>>>         dContactGeom contact;
>>>
>>>         dGeomRaySet(ray, start[0], start[1], start[2], 
>>> end[0]-start[0], end[1]-start[1], end[2]-start[2]);
>>>         dGeomRaySetLength(ray, 100);
>>>
>>>     for(int i = 0; i < NUM_BODYS; i++){
>>>
>>>         g = box[i];
>>>         if (int numc = dCollide (ray,g, 0,&contact, 
>>> sizeof(dContact))) {
>>>                        printf("collision with %s\n", 
>>> get_body_name(i));
>>>             dGeomRaySetLength(ray, 0);
>>>             return;
>>>         }
>>>     }
>>> }
>>>
>>> cheers
>>> /Hampa
>>> SXP
>>>
>>> _______________________________________________
>>> ODE mailing list
>>> ODE at q12.org
>>> http://q12.org/mailman/listinfo/ode
>>>
>>
>> _______________________________________________
>> ODE mailing list
>> ODE at q12.org
>> http://q12.org/mailman/listinfo/ode
>>
>>
>>
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>



More information about the ODE mailing list