xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
738 stars 291 forks source link

SnapPick don't work without canvasPos? #1537

Closed g-rodigy closed 5 months ago

g-rodigy commented 5 months ago

Describe the bug Hello. Has error when try get viewer.scene.pick() with params origin, direction and snapToEdge: true. Got error

Cannot read properties of undefined (reading '0') at ...

reading '0' is canvasPos[0] https://github.com/xeokit/xeokit-sdk/blob/160b384c1ee5063a0a5fbe4e899f2e744b67d23d/src/viewer/scene/webgl/Renderer.js#L1319-L1322

To Reproduce

viewer.scene.pick({
   origin,
   direction,
   pickSurface: true,
   pickSurfaceNormal: true,
   pickSurfacePrecision: true,
   snapToEdge: true,
   snapToVertex: false,
})

Expected behavior If found entity get nearest edge like work with canvasPos.

Desktop (please complete the following information):

Additional context xeokit-sdk v2.6.9

xeolabs commented 5 months ago

Yes, Scene.snapPick() only works with canvasPos - I've updated the docs accordingly.

BTW do you represent one of our enterprise users? If so, please get in touch and we can prioritize support via our Jira: https://creoox.com/en/contact/