Tao.Ode SDK Documentation

Ode.dCreateRay Method 

Create a ray geom of the given length, and return its ID. If space is nonzero, insert it into that space.

[Visual Basic]
Public Shared Function dCreateRay( _
   ByVal space As IntPtr, _
   ByVal length As Single _
) As IntPtr
[C#]
public static IntPtr dCreateRay(
   IntPtr space,
   float length
);

Parameters

space
the space to add the ray to
length
the length of the ray

Return Value

the id of the new ray

Remarks

A ray is different from all the other geom classes in that it does not represent a solid object. It is an infinitely thin line that starts from the geom's position and extends in the direction of the geom's local Z-axis. Calling dCollide between a ray and another geom will result in at most one contact point. Rays have their own conventions for the contact information in the dContactGeom structure (thus it is not useful to create contact joints from this information): pos - This is the point at which the ray intersects the surface of the other geom, regardless of whether the ray starts from inside or outside the geom. normal - This is the surface normal of the other geom at the contact point. if dCollide is passed the ray as its first geom then the normal will be oriented correctly for ray reflection from that surface (otherwise it will have the opposite sign). depth - This is the distance from the start of the ray to the contact point. Rays are useful for things like visibility testing, determining the path of projectiles or light rays, and for object placement.

See Also

Ode Class | Tao.Ode Namespace