Skip to content

Commit

Permalink
Merge pull request #551 from xeokit/pick-entity-optional
Browse files Browse the repository at this point in the history
Fix surface picking option to not pick surface normal #550
  • Loading branch information
xeolabs authored Jan 27, 2021
2 parents 51a3425 + 4ddb350 commit 7a5c2d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class PickController {

this.pickResult = this._scene.pick({
pickSurface: true,
pickSurfaceNormal: true,
pickSurfaceNormal: false,
canvasPos: this.pickCursorPos
});

Expand Down
2 changes: 1 addition & 1 deletion src/viewer/scene/scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,7 @@ class Scene extends Component {
pickResult = this._renderer.pick(params, pickResult);

if (pickResult) {
if (pickResult.entity.fire) {
if (pickResult.entity && pickResult.entity.fire) {
pickResult.entity.fire("picked", pickResult); // TODO: PerformanceModelNode doesn't fire events
}
return pickResult;
Expand Down
4 changes: 3 additions & 1 deletion src/viewer/scene/webgl/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,9 @@ const Renderer = function (scene, options) {
nearAndFar[1] = scene.camera.project.far;

pickWorldPos(pickable, canvasX, canvasY, pickViewMatrix, pickProjMatrix, nearAndFar, pickResult);
pickWorldNormal(pickable, canvasX, canvasY, pickViewMatrix, pickProjMatrix, nearAndFar, pickResult);
if (params.pickSurfaceNormal !== false) {
pickWorldNormal(pickable, canvasX, canvasY, pickViewMatrix, pickProjMatrix, nearAndFar, pickResult);
}
}
}
}
Expand Down

0 comments on commit 7a5c2d4

Please sign in to comment.