c# - trouble about working with material of model visual 3d? -
i made 3d box in code behind.
i want color of material (for example, diffusematerial) in string format using raymeshgeometry3dhittestresult result1
in mouse left button down:
geometrymodel3d result2 = result1.modelhit geometrymodel3d;
i used:
messagebox.show(result2.material.tostring());
this not work!
thanks alot.
if want color of brush
used create diffusematerial
string
need first check if diffusematerial
, not materials need work of brush
, , have check if brush
solidcolorbrush
support single color. below should work:
diffusematerial material = result2.material diffusematerial; if (material != null) { string brushcolor = null; var brush = material.brush solidcolorbrush; if (brush != null) brushcolor = brush.color.tostring(); }
Comments
Post a Comment