Object not receiving shadow from other objects

Software: Away3D 3.x

kontur, Newbie
Posted: 27 September 2012 08:05 AM   Total Posts: 1

Hey,

I am fairly new to away3d. From resources on the web I have put together a somewhat working scene, but I can’t seem to figure out how to get objects to cast shadow.

In the scene, the cube and sphere objects are above the plane and under the light, yet the plane does not receive shadows. What am I missing here?

My code is in away 3.6…

package  {
 
 import flash
.display.MovieClip;
 
import flash.events.*;
 
import away3d.containers.View3D;
 
import away3d.primitives.Cube;
 
import away3d.primitives.Plane;
 
import away3d.lights.DirectionalLight3D;
 
import away3d.materials.PhongColorMaterial;
 
import away3d.materials.ColorMaterial;
 
import flash.geom.Vector3D;
 
 
 public class 
Test7 extends MovieClip {
  
  
public var view:View3D;
  public var 
light:DirectionalLight3D;
  
  public var 
cube:Cube;
  public var 
plane:Plane;  
  
  public function 
Test7() {
   
// constructor code
   
view = new View3D();
   
view.200;
   
view.200;
   
view.150;
   
   
light = new DirectionalLight3D();
   
light.direction = new Vector3D(0, -10);
   
light.brightness 5;
   
view.scene.addLight(light);
   
   
plane = new Plane();
   
plane.material = new PhongColorMaterial(0xCCCCCC);
   
plane.width 1000;
   
plane.height 1000;
   
plane.segmentsH 
   
plane.segmentsW 10;
   
plane.= -100;
   
view.scene.addChild(plane);
   
   
cube = new Cube();
   
cube.rotationX 45;
   
cube.rotationY 45;
   
cube.segmentsD 
   
cube.segmentsH 
   
cube.segmentsW 10;
   
cube.material = new PhongColorMaterial(0x330099);
   
//cube.material = new ColorMaterial(0x330099);
   
view.scene.addChild(cube);
   
   
addChild(view);
   
addEventListener(Event.ENTER_FRAMErender);   
  
}
  
  
public function render(e:Event):void {
   view
.render();
  
}
 }
 

edit: I updated the code example to be more separated, now there is only a plane and a cube.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X