Is there’s a way to change the color material of specific sub mesh?

Software: Away3D 4.x

Josh, Newbie
Posted: 10 August 2012 03:30 AM   Total Posts: 24

Hi,

  I have a problem, how to assign color material to specific sub mesh. I have a map, composed of more than 35 sub meshes. i like to assign different color material to 5 sub meshes on it.
  Hope can somebody help me.
  By the way im using the latest version of away3d.
Thanx.


Regards,
Josh

   

Richard Olsson, Administrator
Posted: 10 August 2012 11:06 AM   Total Posts: 1192   [ # 1 ]

When you say sub-mesh, do you actually mean the instances of the SubMesh class that can be accessed through a Mesh’s subMeshes property? If that’s the case, just set the material property of the correct sub-mesh from that vector.

myMesh.subMeshes[0].material myColorMaterial

If, however, you are talking about children of a mesh, you can access them using the mesh’s getChildAt function, and treat them as regular meshes (if that is indeed their type).

if (myMesh.getChildAt(0is Mesh)
  
Mesh(myMesh.getChildAt(0)).material myColorMaterial
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X