Any way to get Sprite3D to cast a shadow?

Software: Away3D 4.x

Tricky Widget, Newbie
Posted: 17 June 2012 11:20 AM   Total Posts: 19

It seems that Sprite3D doesn’t cast a shadow by default.  Is there any way to get it to cast one?

Thanks!


Example:

package
{
 import away3d
.containers.View3D;
 
import away3d.entities.Mesh;
 
import away3d.entities.Sprite3D;
 
import away3d.lights.DirectionalLight;
 
import away3d.materials.lightpickers.StaticLightPicker;
 
import away3d.materials.ColorMaterial;
 
import away3d.materials.methods.HardShadowMapMethod;
 
import away3d.primitives.CubeGeometry;
 
import flash.display.Sprite;
 
import flash.events.Event;
 
 public class 
Main extends Sprite
 {
  
public var view:View3D = new View3D();
  
  public function 
Main():void
  {
   
var directonalLight:DirectionalLight = new DirectionalLight(0010);
   
view.scene.addChild(directonalLight);
   
   var 
plainColorMaterial:ColorMaterial = new ColorMaterial(0xff0000);
   
plainColorMaterial.lightPicker = new StaticLightPicker([directonalLight]);
   
   var 
plainCube:Mesh = new Mesh(new CubeGeometry(), plainColorMaterial);
   
plainCube.= -200;
   
plainCube.= -100;
   
view.scene.addChild(plainCube);
   
   var 
plainSprite3D:Sprite3D = new Sprite3D(plainColorMaterial100100);
   
plainSprite3D.200;
   
plainSprite3D.= -100;
   
view.scene.addChild(plainSprite3D);
   
   var 
shadowColorMaterial:ColorMaterial = new ColorMaterial(0x00ff00);
   
shadowColorMaterial.lightPicker = new StaticLightPicker([directonalLight]);
   
shadowColorMaterial.shadowMethod = new HardShadowMapMethod(directonalLight);
   
   var 
shadowCube:Mesh = new Mesh(new CubeGeometry(100010001000), shadowColorMaterial);
   
shadowCube.1000;
   
view.scene.addChild(shadowCube);
   
   
view.camera.= -500;
   
   
addChild(view);
   
   
this.addEventListener(Event.ENTER_FRAMEonEnterFrame);
  
}
  
  
private function onEnterFrame(event:Event):void
  {
   view
.render();
  
}
 }
   

cyberprodigy, Newbie
Posted: 20 August 2012 08:28 PM   Total Posts: 1   [ # 1 ]

I know. I think they broken shadow casting in Away3D 4. Shadow casting is not working any more.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X