Page 1 of 1

How to set the plane of the box primitive with different color

Posted: Tue May 10, 2016 2:44 pm
by zzwbeyond
Hello, I want set different color in different plane of the box primitive. And I have modify the 'buildUp' method in ccBox.cpp, but it don't work.

So is there any solution to do this? Thanks.

Re: How to set the plane of the box primitive with different color

Posted: Tue May 10, 2016 3:04 pm
by daniel
You'll have to add 'materials' to the primitive:
- define 6 materials (one per face). The color should be set on the 'diffuse' component of the material.
- then add per-triangle material indexes
- define the index for each triangle (each face of the box has 2 triangles)
- and don't forget to set 'showMaterials' to true

Re: How to set the plane of the box primitive with different color

Posted: Thu May 12, 2016 12:52 pm
by zzwbeyond
Thanks daniel, I can set different color now.
And I want ask another question, how can I hide the bounding box of the box primitive or other primitive entity? I see other people have asked, but there is no answer.

Re: How to set the plane of the box primitive with different color

Posted: Thu May 12, 2016 6:46 pm
by daniel
You mean programatically? If yes then you can simply call 'setSelected(false)'.