Xav Posted April 8, 2016 Share Posted April 8, 2016 Hello, I want to toggle Overlay on my obj. I do this : //This is my function to get selected object: function MouseOverObj(){ currentMesh=scene.meshUnderPointer; if (currentMesh ){ return currentMesh; } } // and my function to changed it on mouse over: function toggleOverlay (){ MouseOverObj(); if (obj){ if(obj !== currentMesh ){ obj.renderOverlay=false; }else{ if (obj.renderOverlay == false){ obj.renderOverlay=true; //obj.OverlayAlpha=0.2; } } } obj=currentMesh; } and i put it on scene.registerBeforeRender(function() { toggleOverlay(); }); Is work perfectly but I wich your opinion on whether this is the best method to do this properly? (sorry for my bad english ) Thank Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 8, 2016 Share Posted April 8, 2016 Hello! sounds like a good option. If you want you can create an repro on the playground that we can use to discuss and test. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Xav Posted April 13, 2016 Author Share Posted April 13, 2016 Hello I tested on the playground but it does not work: http://www.babylonjs-playground.com/#1GFDNL#0. But it work perfectly with my .js script ... ? I use it with .babylon file on the pickable enabled object. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 14, 2016 Share Posted April 14, 2016 Here is a working version: http://www.babylonjs-playground.com/#1GFDNL#1 and I find it pretty great Quote Link to comment Share on other sites More sharing options...
Xav Posted April 14, 2016 Author Share Posted April 14, 2016 Ok Thank 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.