Anonymous Posted March 7, 2016 Share Posted March 7, 2016 var b1=new BABYLON.Mesh.CreateBox("box1",3.0,scene); var b11=new BABYLON.StandardMaterial("b11",scene); b11.diffuseColor=new BABYLON.Color3(1,1,0); b1.material=b11; i have created one box and applied material property and i have also subtracted another box from b1 box using babylon.csg like var b2=new BABYLON.Mesh.CreateBox("box2",1.0,scene); var b1CSG=BABYLON.CSG.FromMesh(b1); var b2CSG=BABYLON.CSG.FromMesh(b2); subCSG=b1CSG.subtract(b2CSG); b1.dispose(); b2.dispose(); subCSG.toMesh("csg",new BABYLON.StandardMaterial("mat",scene),scene); After this, hole is created inside box1 but the material property i have given is not applied to the box1. How can i apply this material property to box1 after dispose method? Thanks...!! Quote Link to comment Share on other sites More sharing options...
JohnK Posted March 7, 2016 Share Posted March 7, 2016 Hi Anonymous (who is that masked stranger) and welcome to the forum. Do you know about the playground ? Putting your code into the playground is the best way to get help from the many responsive people on this forum. NOTE do not use new when creating a box mesh. In your line subCSG.toMesh("csg",new BABYLON.StandardMaterial("mat",scene),scene); the new standard material you created has not been given any properties use a material you have previously set see PG below. Here is a working playground http://www.babylonjs-playground.com/#GSRTH#1 RaananW, GameMonetize and Anonymous 3 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.