MousePick()

Syntax

Result = MousePick(#Camera, x, y [, PickMask])
Description
Simulates a mouse click and returns which object is under the specified 2D point on the specified camera.

Parameters

#Camera The camera to use.
x, y The coordinates, in pixels, of the point.
PickMask (optional) The entity mask used while performing the ray cast. 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 detected
  #PB_World_WaterPick: the click occurred on the water.
  #PB_World_TerrainPick: the click occurred on a terrain.
  0 and above: the click occurred on the #Entity. The entity pick 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

All

<- LoadWorld() - Engine3D Index - MouseRayCast() ->