Jump to content

[solved] mesh.isPickable is not working


MinsuKim
 Share

Recommended Posts

long time no see this forum

i has one issue

mesh.isPickable = false <<<< this code is not working

below my code

for (let currentIndex = 0; currentIndex < idx.mScene.meshes.length; currentIndex++) {
                idx.mScene.meshes[currentIndex].isPickable = pickable;
            };

 

but i don't understand..... why not working....

i'm already see other playground

http://www.babylonjs-playground.com/#1C5IUC

 

my code and there code different

1. my mesh in code 

var material2 = new BABYLON.StandardMaterial("material2", scene);
let box = BABYLON.MeshBuilder.CreateBox(dynamicName, facOptions, scene);
box.material = material2;

2. there code(play ground)

var lineRed = BABYLON.MeshBuilder.CreateLines("red",{
        points: [new BABYLON.Vector3(0, 1, 0),
                 new BABYLON.Vector3(2, 1, 0)]}, scene);    
    lineRed.color = BABYLON.Color3.Red();   
    lineRed.isPickable = false;
 
 
my code and there code some different??? samething code in my eyes O_O......
please help me
Link to comment
Share on other sites

If you pass in a predicate then the isPickable is ignored:
https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L5406
 

I can think of 2 possible solutions.

Either check in the predicate what you want to ignore (explicitly check isPickable):
https://playground.babylonjs.com/#ZLL01M#1
or check after without a predicate - note along with mesh.isPickable that this also checks mesh.isEnabled() and mesh.isVisible:
https://playground.babylonjs.com/#ZLL01M#2
 

Predicates are designed to allow us to override the default behaviour. ie: some people want to maybe include hidden meshes.

Link to comment
Share on other sites

  • MinsuKim changed the title to [solved] mesh.isPickable is not working

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...