Class: Picker
Class: Picker
A Tool for manual user picking points on faces and vertices and finding their coordinates and normal.
Constructors
Constructor
new Picker(
renderManager,viewerElement):Picker
Parameters
renderManager
RenderManagerBase instance.
viewerElement
HTMLElement
viewer HTML element.
Returns
Picker
Properties
additionalObjects
additionalObjects:
Set<Mesh<BufferGeometry<NormalBufferAttributes>,Material|Material[],Object3DEventMap> |Line<BufferGeometry<NormalBufferAttributes>,Material|Material[],Object3DEventMap> |InstancedMesh<BufferGeometry<NormalBufferAttributes>,Material|Material[],InstancedMeshEventMap>>
Additional objects with picking capability.
hasIntersection
hasIntersection:
boolean
Is there a intersection with picking ray and vertex or face.
intersectionType
intersectionType:
PickerIntersectionType
The type of active intersection.
isBlockSelection
isBlockSelection:
boolean
Whether the selection of elements during picking is locked or not.
rayFaceNormal
rayFaceNormal:
Vector3
The normal of the face on which the rayPoint is located.
rayPoint
rayPoint:
Vector3
The point on vertex or face from the picking ray.
Methods
dispose()
dispose():
void
Destroy picker and release all events.
Returns
void
endPicking()
endPicking(
isCanceled?):boolean
End picking action.
Parameters
isCanceled?
boolean
Action result. Will be passed to the callbacks.
Returns
boolean
True if picking has been ended successfully.
getElementSurfacePoint()
getElementSurfacePoint(
targetElNum):Vector3
Returns the ray–surface intersection point for a specific element. Traverses the BVH of all meshes, filtering triangles by the _elementnum attribute. Occlusion by other elements is ignored. Returns null if the ray does not hit the element's geometry.
Parameters
targetElNum
number
Returns
Vector3
getSceneIntersection()
getSceneIntersection():
PickerIntersection[]
A Get intersection with scene object below mouse coords.
Returns
PickerIntersection[]
onBeforeEnd()
onBeforeEnd(
callback):this
Add callback for end picking event. Callback stores only for one picking session called by startPicking.
Parameters
callback
(isCanceled) => boolean | void
Callback function. The callback must return true, false, or undefined. If the callback returns false, the "end picking" operation will be aborted and the picker will remain active.
Returns
this
onEnd()
onEnd(
callback):this
Add callback for end picking event. Callback stores only for one picking session called by startPicking.
Parameters
callback
(isCanceled) => void
Callback function.
Returns
this
onPick()
onPick(
callback):this
Add callback for 'pick' event. Callback stores only for one picking session called by startPicking. If callback returns false then 'end' event will chanceled.
Parameters
callback
(intersectionType, rayPoint, rayFaceNormal) => void
Callback function.
Returns
this
setMessage()
setMessage(
message):this
Set optional message for user during the picking process. The message is active only for one picking session called by startPicking.
Parameters
message
string
Hint message.
Returns
this
setWorkPlane()
setWorkPlane(
plane):this
Set optional work plane to allow picking point in empty space.
Parameters
plane
Plane
Work plane
Returns
this
startPicking()
startPicking(
blockSelection?,stopAtClick?,snapToPoints?,snapToLines?,snapToWorkPlane?):Picker
Starts picking action.
Parameters
blockSelection?
boolean
Block selection of elements during picking or not.
stopAtClick?
boolean
Stop picking after the first click or continue onward.
snapToPoints?
boolean
Snap to vertices or on faces.
snapToLines?
boolean
Snap to vertices on lines.
snapToWorkPlane?
boolean
Snap to work plane in empty space.
Returns
Picker
Picker instance if picking started successfully or undefined if not.
update()
update():
void
Run from the render loop: applies deferred hover picking at most once per frame.
Returns
void