adam Posted March 25, 2016 Share Posted March 25, 2016 I've been working on something that required me to look into the scene._internalPick. https://github.com/BabylonJS/Babylon.js/blob/99bb973bee5779f5941a28767b801035b58782a0/src/babylon.scene.js#L1964 Every time the mouse moves it loops through the meshes in the scene and if the mesh passes the predicate test it checks to see if the ray intersects it. The intersect method allocates a BABYLON.PickingInfo object on each call. If a PickingInfo object isn't created on the last pass of the loop, one is allocated to return to the caller of internalPick. I'm pretty sure this happens by default: https://github.com/BabylonJS/Babylon.js/blob/99bb973bee5779f5941a28767b801035b58782a0/src/babylon.scene.js#L617 What would be a good way to disable that if someone doesn't need it? Quote Link to comment Share on other sites More sharing options...
adam Posted March 25, 2016 Author Share Posted March 25, 2016 I'm aware I can do this: scene.pointerMovePredicate = function (mesh) { return false; } but the _internalPick function is still called and loops through all the meshes. Quote Link to comment Share on other sites More sharing options...
adam Posted March 25, 2016 Author Share Posted March 25, 2016 Typescript doesn't like this: var eventPrefix = BABYLON.Tools.GetPointerPrefix(); scene.getEngine().getRenderingCanvas().removeEventListener(eventPrefix + "move", scene.onPointerMove); Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 25, 2016 Share Posted March 25, 2016 About TypeScript - cast the rendering canvas to HTMLElement, should do the trick. Quote Link to comment Share on other sites More sharing options...
adam Posted March 25, 2016 Author Share Posted March 25, 2016 It's complaining about scene.onPointerMove. I'm supposed to be referencing scene._onPointerMove, but it is private. https://github.com/BabylonJS/Babylon.js/blob/99bb973bee5779f5941a28767b801035b58782a0/src/babylon.scene.ts#L182 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 25, 2016 Share Posted March 25, 2016 What about calling scene.detachControl(canvas) ? Quote Link to comment Share on other sites More sharing options...
adam Posted March 25, 2016 Author Share Posted March 25, 2016 That would remove pointerDown, which I would like to use. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 25, 2016 Share Posted March 25, 2016 Ok..Understodd.Give me a few minutes Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 25, 2016 Share Posted March 25, 2016 clock's ticking.... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 25, 2016 Share Posted March 25, 2016 Ok...so new version call scene.detachControl() and now you can call scene.attachControl(true, true, false) here is the new attachControl signature:public attachControl(attachUp = true, attachDown = true, attachMove = true) { Quote Link to comment Share on other sites More sharing options...
adam Posted March 25, 2016 Author Share Posted March 25, 2016 Thanks! 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.