Steffen Posted November 15, 2017 Share Posted November 15, 2017 Hi, when using var hitInfo = scene.pickWithRay(ray, null, true); I would expect that the ray only checks the boundingboxes and not the mesh. So if I import an "open package" where the ray can go through the object without collision, I want to check only if the ray hits the boundingbox, but this doesn't seem to work. Here is a playground: http://www.babylonjs-playground.com/#5PMLFP Thanks, Steffen Quote Link to comment Share on other sites More sharing options...
Xav Posted November 15, 2017 Share Posted November 15, 2017 Hello, You'll need mesh.boundingBox.isPickable = false, but I do not think it's available. You can cheat by folding a box set it in wireframe and you can deactivate the property box.isPickable = false? I do not know if that can help you? Good luck in your search. Quote Link to comment Share on other sites More sharing options...
Steffen Posted November 15, 2017 Author Share Posted November 15, 2017 (edited) I don't think I understand you correctly... If you set the "isPickable" param to "false", the ray will ignore the mesh. See line 50: http://www.babylonjs-playground.com/#5PMLFP#1 EDIT: Solved. The comment in the doc for pick/pickWithRay is very irritating. Or it is just me and @aWeirdo (do you have a workaround?). Quote from @Deltakosh Quote The fast check using bounding boxes to invalidate candidate. Not to validate them. Edited November 15, 2017 by Steffen solved... Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 15, 2017 Share Posted November 15, 2017 Hi @Steffen The picking doesn't pick by boundingboxes. I ended up doing a workaround thus far, a prototype for abstractMesh which adds a "picking Box" (just a BABYLON.Mesh.CreateBox) the size of the mesh's bounding box, parented to the mesh, only pickingBox has isPickable and then a visibility of 0.001 or so. And on picking it's just pickedMesh.parent to get the actual mesh. I hope it makes sense. Steffen and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
Steffen Posted November 15, 2017 Author Share Posted November 15, 2017 Thanks, Yes I thought of this approch too. Just hoped there is a "more elegant" solution or a babylon method I have not in mind. Thanks anyway! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 15, 2017 Share Posted November 15, 2017 Hi guys. In another thread, some folks are/were playing with picking... for drag/drop usage. Here's the latest PG: https://www.babylonjs-playground.com/#WWCK0#70 (For some reason, this PG requires ONE MORE click of the RUN button, before it is normal). In lines 3-67, we "installed" (hijacked) the abstract mesh intersects() function (used for picking)... into the playground. Then we added many console.logs to it... to learn and test things. Most important... line 53... which tells (at console) the name of mesh for each pickedPoint that happens during a single pointerDown pick. Open console, then do a single pick on a "barrel". It looks like about 4-6 picks happen for one pointerDown. Even the add-on "elli" sphere (mesh.ellipsoidMesh) is sometimes picked (if you pick high enough on barrel)... even though it is set isPickable = false in line 86. Why so many pickedPoints for a single pick? Perhaps... do this forum search for 'multi-picks'. I believe multi-pick returns an array of all the pickedPoints (including which mesh was hit for each pick-point). It might be worth investigating. Perhaps a predicate/conditional could be used. Maybe multipick code could be modified to ONLY return pick-hits from a certain "class" or "tag-group". (variable-criteria filtering). You could also use mesh.metadata as an "Allow this mesh to be included in multi-pick returns?" -flag. Then hijack (borrow from here) the multi-pick code into your home project, and modify it... to ONLY include mesh whose .metadata = true, or whose .metadata = { allowReturnInMultiPicks: true, whatever: whatever, etc: etc } Just some goofy Wingnut ideas. Be well, guys. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2017 Share Posted November 15, 2017 Not sure of the usage but we can also think about adding an optional parameter to pick and pickWithRay to specify we just want bounding box picking Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.