Using a lightPicker with a ColorMaterial results in error RangeError: Error #3669: Bad input size

Software: Away3D 4.x

frank_a, Newbie
Posted: 15 March 2012 06:14 PM   Total Posts: 5

I’m trying to create a shaded material to use on a loaded .obj file.

I’m using a a directional light with a StaticLightPicker

dlight = new DirectionalLight();
dlight.ambient=1;
dlight.specular=0.25
scene
.addChild(dlight);
   
lightPicker= new StaticLightPicker([dlight]);
dlight.direction = new Vector3D(0,1,-2); 

Inside of my load complete handler I’m creating the material and assigning it

var mesh:Mesh;
   
primitiveMaterial = new ColorMaterial(0xffffff);
   
primitiveMaterial.bothSides=true;
   
primitiveMaterial.diffuseLightSources LightSources.LIGHTS;
   
primitiveMaterial.ambientColor 0xfff
   primitiveMaterial
.ambient 1;
   
primitiveMaterial.specular .2;
   
primitiveMaterial.alpha=1;
   
primitiveMaterial.lightPicker=lightPicker;
 
   
   for(var 
i:int loader.numChildreni++){
    mesh 
loader.getChildAt(0) as Mesh;
    
mesh.material primitiveMaterial
    
   
}
  
   view
.scene.addChild(loader);
   
loader.moveForward(250); 

This seems to be giving me this error:

Main Thread (Suspended: RangeError: Error #3669: Bad input size.)

Any one know why?

   

Mr Margaret Scratcher, Sr. Member
Posted: 15 March 2012 11:25 PM   Total Posts: 344   [ # 1 ]

Have you tried putting traces in to see where your code falls down?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X