Search the Community
Showing results for tags 'facecolor'.
-
Hi all New to this Babylon.js malarky and trying to develop a 3D mini-app that will allow user to manipulate building blocks of some sort (e.g. add more blocks. move/rotate them and join them together). Whilst prototyping this, the blocks (ie meshes) are all cubes created using createBox and with different coloured faces (top and bottom are red and other sides are blue). I have used the new faceColor option on createBox to do this on creation. However I want to add behaviour that will temporarily change colour of blocks (e.g. turn them green) as user clicks on them to effectively show that is the selected block, reverting to standard colours when "deselected" (ie when another block is selected). Is there an easy way to reference the box faces in a similar way to faceColors when constructing using createBox? e.g. currentBox.faceColors[0]=new BABYLON.color3.red() ... I am guessing not. If no, then is there a technique for easily identifying the vertices that make up the 2 triangles for each face and changing those vertex colors independently? Note: I read the debate on naming convention for box sides/faces. For avoidance of doubt when I say "face" here I am referring to a real-world face or side of the cube rather than the individual triangles that make up that side. Note2: I will want to add some additional behaviour that allows a user to conjoin 2 cubes when in close proximity to each other (a kind of snap-to if you like) but only allow that behaviour on certain sides (imagine a crude Lego (TM) block that can only be connected on top of each other not side to side). So with one eye to the future, any mechanism for identifying individual faces needs to work for that to. Thanks muchly Richard