Skip to content

LinePick

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions
Blitz3D

LinePick

LinePick:Int32 x:Float32, y:Float32, z:Float32, dx:Float32, dy:Float32, dz:Float32, radius:Float32=0
Parameter Mode Type Default Description
x In Float32 required Start X in world coordinates.
y In Float32 required Start Y.
z In Float32 required Start Z.
dx In Float32 required How far the line goes along X.
dy In Float32 required How far the line goes along Y.
dz In Float32 required How far the line goes along Z.
radius In Float32 0 Thickness of the line. Defaults to 0.

Returns: The entity found, or 0.

Description

Looks along a line from a start point in a direction and returns the first pickable entity it meets. The direction is not normalized: the line ends where x + dx, y + dy, z + dz ends, so longer vectors look further. With a radius greater than 0 the line becomes a thick tube, which finds things that a hairline would slip past.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()

wall = CreateCube()
PositionEntity wall, 0, 0, 10
EntityPickMode wall, 2

; Shoot a line from the camera straight ahead, 20 units long.
hit = LinePick(0, 0, 0, 0, 0, 20)
If hit = wall Then
	Text 8, 8, "Hit the wall at z = " + PickedZ()
	Text 8, 24, "Surface normal: " + PickedNX() + ", " + PickedNY() + ", " + PickedNZ()
Else
	Text 8, 8, "Nothing there"
EndIf
Flip
WaitKey

Related Commands

CameraPick, EntityPick, EntityPickMode, EntityVisible

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally