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 = 0 ; i < loader.numChildren; i++){
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?