Result = RayPick(x, y, z, DestinationX, DestinationY, DestinationZ [, PickMask])
Casts a ray between the first point and the second point, and checks if an object is crossing the ray.


x, y, z The first point coordinates, in world unit.
DestinationX, DestinationY, DestinationZ The second point coordinates, in world unit.
PickMask (optional) The entity mask used while performing the ray pick. Only the entities with a mask matching the PickMask value will be reported. If this parameter is omitted, all the entities are valid for the ray detection. The mask can be a combination, to select more than one entity group. To have more information about pick mask, see CreateEntity().

Return value

The returned value can be:
  -1 : Nothing has been crossed.
  #PB_World_WaterPick: the ray crossed the water.
  #PB_World_TerrainPick: the ray crossed a terrain.
  0 and above: the ray crossed an #Entity. The entity detection is based on its bounding box, not on its mesh.
To get more information about the picked object position, use PickX(), PickY() and PickZ().

Supported OS


<- RayCollide() - Engine3D Index - RenderWorld() ->