Dejan Posted October 24, 2016 Share Posted October 24, 2016 (edited) Hi guys, I have a problem with mesh picking and it is a specific case. When I create a ribbon like this, I can see it on the scene: var someRibbon = BABYLON.Mesh.CreateRibbon("ribb", [[new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(10, 0, 0)], [new BABYLON.Vector3(0, 10, 0), new BABYLON.Vector3(10, 10, 0)]], false, false, 0, _scene, true, BABYLON.Mesh.FRONTSIDE); On mouse down I am writing the name of the picked mesh in the log: handleMouseDown: function(event){ var pickResult = _scene.pick(_scene.pointerX, _scene.pointerY); var pickedPoint = pickResult.pickedPoint; console.log(pickResult.pickedMesh.name); // writes ribb when I click on it } BUT, when I update the ribbon mesh after creation, like this: var someRibbon = BABYLON.Mesh.CreateRibbon("ribb", [[new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(10, 0, 0)], [new BABYLON.Vector3(0, 10, 0), new BABYLON.Vector3(10, 10, 0)]], false, false, 0, _scene, true, BABYLON.Mesh.FRONTSIDE); someRibbon = BABYLON.Mesh.CreateRibbon(null, [[new BABYLON.Vector3(0, 0, 5), new BABYLON.Vector3(10, 0, 5)], [new BABYLON.Vector3(0, 10, 5), new BABYLON.Vector3(10, 10, 5)]], null, null, null, null, null, null, someRibbon); Then I can see that the ribbon that is updated (moved 5units along z axis), but it can't be picked. Actually, the picker "thinks" that the ribbon is still in the old position. Does someone have any idea how this could be solved? Edited October 24, 2016 by Dejan Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 24, 2016 Share Posted October 24, 2016 Ping @jerome Quote Link to comment Share on other sites More sharing options...
jerome Posted October 24, 2016 Share Posted October 24, 2016 this bug is fixed in the 2.5 : https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview release/what's new.md Added BBox update on each ribbon based shape (ribbon, tube, extrusion, etc) on dynamic updates (jerome) just refresh the ribbon._boundingInfo() else Dejan 1 Quote Link to comment Share on other sites More sharing options...
Dejan Posted October 25, 2016 Author Share Posted October 25, 2016 Oh boy, it works now! Thank you for the quick response.I really enjoy working with this engine. Keep up the good work 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.