JackFalcon Posted February 11, 2018 Share Posted February 11, 2018 After highlighting a layer... what is the best way to remove that highlight? In other words: after addmesh() to a highlight layer, is there a remove mesh? Looking in docs, code and playground... . For example: hover toggle highlight. Falcon deep-dives... into deglow. Thx. Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted February 11, 2018 Author Share Posted February 11, 2018 SOLUTION: hooray... found it in the code. /** * Remove a mesh from the highlight layer in order to make it stop glowing. * @param mesh The mesh to highlight */ HighlightLayer.prototype.removeMesh = function (mesh) { var meshHighlight = this._meshes[mesh.uniqueId]; if (meshHighlight) { mesh.onBeforeRenderObservable.remove(meshHighlight.observerHighlight); mesh.onAfterRenderObservable.remove(meshHighlight.observerDefault); } this._meshes[mesh.uniqueId] = undefined; this._shouldRender = false; for (var meshHighlightToCheck in this._meshes) { if (meshHighlightToCheck) { this._shouldRender = true; break; } } }; The entire HighlightLayer is beautiful code btw. Testing... yep, hl.removeMesh(mesh) worked famously. Ok, happy to help. : ) Quote Link to comment Share on other sites More sharing options...
Guest Posted February 12, 2018 Share Posted February 12, 2018 Pinging @Sebavan for doc update Quote Link to comment Share on other sites More sharing options...
Sebavan Posted February 20, 2018 Share Posted February 20, 2018 Doc Updated, thanks for the feedback: https://github.com/BabylonJS/Documentation/commit/388a4f6fc123cd4fc07f8e42d9935ef798287a9d#diff-e6cb7931d15218e4b2abff8137625e02 GameMonetize and JackFalcon 1 1 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.