inxs Posted November 8, 2017 Share Posted November 8, 2017 Hello guys, when I click on a Mesh I want to dispose the current material of a mesh and assign a new material. It was working on a previous version of babylon, but I dont know why its not working anymore. I made a PG to show this Problem: http://www.babylonjs-playground.com/#5T7GJE Thanks Jonny Quote Link to comment Share on other sites More sharing options...
mr_pinc Posted November 8, 2017 Share Posted November 8, 2017 You were missing 'BABYLON.' from the constructor for standard material. The error was in the JS console. Fixed here: http://www.babylonjs-playground.com/#5T7GJE#1 Quote Link to comment Share on other sites More sharing options...
inxs Posted November 8, 2017 Author Share Posted November 8, 2017 This was a copy and paste error from my Angular Solution. Crap .... Why doesnt it work in my solution? It seems the "old" Standard Material does not get removed: It is almost exactly the same code... Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 8, 2017 Share Posted November 8, 2017 Hiya Inxs, sorry to hear you are having problems. General advice: console.log(everything); console.log(mesh.material.name) before the click, after the click, even during the click. Check on every step. Old mesh.material should be gone... once you add a different mesh.material, of course. Throw a scene.render() in there, after the material change, what-the-heck. There HAS TO BE some kind of logical explanation for this. It is likely on the tip of our noses, so naturally, it is difficult to see. I will keep thinking, too. hmm. Report discoveries, if you make some. thx! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 8, 2017 Share Posted November 8, 2017 Hello Inxs, do you have a way to reproduce it in the PG? or at least somewhere where we can see it? 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.