I think you missed the idea:
make a textfield
add changed event to textfield

in your handler add something like

private function onChangedTextfield(e:Event):void
{
        var index:int = Math.floor(Number(mytextfield.text));
        if(index >mesh.faces.length-1 )
                return;
        
        mesh.faces[index].material = someOtherMaterial;
}

now type 0 in your textfield, then 1, then 2
this way you see which face is altered

since it can be tedious iof model is hudge, you probably undertstand now why a slider or numerical stepper would be handy

here for instance an example where i use a scrollbar to identify a face and in this case assign the index of the face for FaceLink
http://www.closier.nl/playground/facelink/facelink2.html

Fabrice

On Sep 2, 2009, at 4:24 PM, mudong wrote:


Fabrice,

I have no idea how to do what you mentioned in your post.

My understanding is that after I load the 3d model into away3d, I have
no way of knowing which face is "face A" which is coupled with
"material A", which face is "face B" which is coupled with "material
B". Now even I add scrollbar or textfield to the faces, I still don't
know which is which.

Please shed more light on this, I am very confused,

Thanks a lot,

Ron



On 9月2日, 下午8时32分, Fabrice3D <[email protected]> wrote:
just make a simple scrollbar, numerical stepper or some textfield and
couple with a setMaterial handler.
like said before, it might be in case of complex shape more easy to
export as separate meshes.
but since its a box, it might be easy to note at dev time from 0 to 30
its side one, from 31 to 60 side two....

Fabrice

On Sep 2, 2009, at 11:30 AM, mudong wrote:





Thanks, Fabrice,

But how do I know which face is face[0], which face is face[1] in my
mesh?

Ron

On 9月2日, 下午5时20分, Fabrice3D <[email protected]> wrote:
if your model have 4 textures applied, you will not be able to apply
as Mesh.material
you will have to loop over the Mesh.faces and set the material per
face.
Mesh.faces[i].material = material;

if the model is (too) complex
you are better off splitting the geometry in more meshes with unique
material in your editor.

Fabrice

On Sep 2, 2009, at 11:06 AM, mudong wrote:

Hello,

Guy, I've been working on this for days, but I still couldn't figure out how to do this. There are couple posts about this topic a while
back, but they didn't help my problem.

Ok, here's what I did. I made a hollowed box in google sketchup,
and I
used different materials(.jpg file) for some surfaces of the
hollowed
box. My model was exported as .dae file. and I loaded this .dae file
in away3d. The .jpg files for material are seperated from the .dae
file. Now I just don't know how to get the material into the 3d
model.

If there was just one material, it's easy, simply add the material. but now I have 4 materials, how do I add the materials and make sure
materials match the surfaces where they are supposed to apply to?

Many thanks,

Ron

Reply via email to