[ODE] Ray - Cylinder collider submission

David Walters hidden.asbestos at googlemail.com
Thu Jun 29 06:28:28 MST 2006


> Thanks for this! I will get it into svn shortly.

Excellent.

One thing I've spotted is the rather untidy code at around line 117 of
my ray.cpp.

I tidier solution is:

-------
// Check if the ray lies completely inside or outside the cylinder.
if ( ( ( uv > 0 ) && ( d + ( uvsign * ray->length ) < half_length *
internal ) ) ||
   ( ( uv < 0 ) && ( d + ( uvsign * ray->length ) > half_length * internal ) ) )
{
  return 0; // No intersection with caps or curved surface.
}

// Compute depth (distance from ray to cylinder)
contact->depth = ( ( -uvsign * d ) - ( internal * half_length ) );
-------

It's not really important to make this change, as I guess the first
step in any development should be initial support for a feature, then
bug fixing, then optimisation... but still, it seemed too messy to
leave it without saying anything: - )


More information about the ODE mailing list