Jump to content

Scene.pick a mesh that is enabled but not visible


Vousk-prod.
 Share

Recommended Posts

Hi,

 

In babylon.scene.js file we can see

Scene.prototype.pick = function (x, y, predicate, fastCheck, camera) {            var _this = this;            /// <summary>Launch a ray to try to pick a mesh in the scene</summary>            /// <param name="x">X position on screen</param>            /// <param name="y">Y position on screen</param>            /// <param name="predicate">Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true</param>            /// <param name="fastCheck">Launch a fast check only using the bounding boxes. Can be set to null.</param>            /// <param name="camera">camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used</param>            return this._internalPick(function (world) {                return _this.createPickingRay(x, y, world, camera);            }, predicate, fastCheck);        };

"a mesh must be enabled, visible and with isPickable set to true"

 

But sometimes we need to be able to pick a mesh even if it is invisible (as long as it is enabled - and pickable, of course -). Yes I know, it seems strange at first, but in some cases meshes could be used as invisible handlers / dummies, to trigger things, to move parenting objects, etc.

 

Could it be possible to change these conditions to only check enabled and pickable params before determining if it is actually picked or not ?

Then it's up to the dev who use bjs framework to decide if the pick info is relevant or not, and thus to deactive the object or to make it not pickable if needed...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...