Class: QgsRayCastHit

Contains details about the ray intersecting entities when ray casting in a 3D map canvas.

Added in version 4.0.

Methods

distance

Returns the hit's distance from the ray's origin

mapCoordinates

Returns the hit position in 3d map coordinates

properties

Returns a map with the properties of the intersected entity.

setDistance

Sets the hit's distance from the ray's origin

setMapCoordinates

Sets the hit point position in 3d map coordinates

setProperties

Sets the point cloud point attributes, empty map if hit was not on a point cloud point

class qgis._3d.QgsRayCastHit[source]

Bases: object

distance(self) float[source]

Returns the hit’s distance from the ray’s origin

Return type:

float

mapCoordinates(self) QgsVector3D[source]

Returns the hit position in 3d map coordinates

Return type:

QgsVector3D

properties(self) Dict[str, Any][source]

Returns a map with the properties of the intersected entity. For vector layer hits, the FID value is stored in key “fid”. For point cloud layer hits, it contains the point attributes keys/values. For tiled scene layer hits, it contains the intersecting node details.

Return type:

Dict[str, Any]

setDistance(self, distance: float)[source]

Sets the hit’s distance from the ray’s origin

Parameters:

distance (float)

setMapCoordinates(self, point: QgsVector3D)[source]

Sets the hit point position in 3d map coordinates

Parameters:

point (QgsVector3D)

setProperties(self, attributes: Dict[str, Any])[source]

Sets the point cloud point attributes, empty map if hit was not on a point cloud point

Parameters:

attributes (Dict[str, Any])