Myjestic Posted November 8, 2017 Share Posted November 8, 2017 Hey fellows, I want to know how to create a cube inside a sphere. The cube should have a texture from an image. The sphere should be transparent like glass. And finally the cube should spin respectively the sphere with the cube inside should spin. I will try to create a PG to prepare the first steps. Quote Link to comment Share on other sites More sharing options...
Myjestic Posted November 8, 2017 Author Share Posted November 8, 2017 So, here is the PlayGround. It's more than the first step, it's the solution . BUT.. can I put both meshes into one object and clone this object multiple times. I want to use different textures for the cubes of the cloned objects. Something like sphere1.cube.material = material1; sphere2.cube.material = material2; sphere3.cube.material = material3; Quote Link to comment Share on other sites More sharing options...
JohnK Posted November 8, 2017 Share Posted November 8, 2017 My suggestion would be to make the sphere parent to the cube, cube.parent = sphere then clone sphere and try sphere1.getChildMeshes()[0].material = material1 etc. Wont be on laptop until tomorrow so cannot change you PG to try it myself. If you combine the sphere and cube into one mesh using mergeMeshes then they have to share a material unless you want to get into multi-materials. Quote Link to comment Share on other sites More sharing options...
Myjestic Posted November 8, 2017 Author Share Posted November 8, 2017 Hey @JohnK, this is exactly what I was looking for. Thank you! https://playground.babylonjs.com/#A7U9WI#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.