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
):Picker
Parameters
renderManager
RenderManagerBase instance.
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.
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
startPicking()
startPicking(
blockSelection
?,stopAtClick
?,snapToPoints
?,snapToLines
?):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.
Returns
Picker
Picker instance if picking started successfully or undefined if not.