Menu

CameraPick

UltraBas

CameraPick camera, x, y

Return the entity that is at the coordinates x and y of the viewport (be careful: coordinates 0,0 point to the bottom left angle of the viewport). If no entity is at the given coordinates, it returns 0.

Not all entities can be picked with this method: to make an entity "pickable", the command [EntityPickMode] is used.

Pitfall: if a mouse is used, mouse coordinates 0,0 refer to the top left angle of a window: so, to get the correct y coordinate, you need to use screen_height - y (screen_height, of course, is the height of the viewport in pixels)


Related

Wiki: Alphabetical-commands
Wiki: Category-commands
Wiki: EntityPickMode

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.