Updating simple shadows when scaling an object

Software: Away3D 3.x

aeki, Member
Posted: 02 November 2011 01:05 PM   Total Posts: 73

I have a ObjectContainer3D with several meshes to which i’ve applied a SimpleShadow effect.

I modify the geometry of some meshes by scaling them, but the shadow doesn’t update with the geometry.

I guess that after rescaling i have to apply the scaling transformation, (as the option is available in Prefab3D) but i can’t see a method ApplyScale or something similar.

Some pieces of my code

private function initObjects():void
  {   
  
   
var loader:Loader3D AWData.load("../assets/bureau3/Bureau3.awd");
   
loader.addEventListener(Loader3DEvent.LOAD_SUCCESSonLoadComplete);
  
}

  
private function onLoadComplete(e:Loader3DEvent):void
  {
   myTrace
.appendText("\n onLoadComplete");
   
myContainer e.loader.handle as ObjectContainer3D;
   
   
myContainer.0;
   
myContainer.0;
   
myContainer.0;
   
myContainer.scale(1);
   
scene.addChild(myContainer);
      
   
// adding shadows
   
ssShadow = new SimpleShadow(myContainer0xff555555,32,-15);
   
ssShadow.apply(view.scene);

   
// Modify geometry of one mesh by rescaling it
    
var plateau:Mesh myContainer.getChildByName("pgauche") as Mesh;
    
plateau.scaleX 0.5;
   
}
  } 

Anyone has an idea on this issue?

   

Avatar
Fabrice Closier, Administrator
Posted: 02 November 2011 01:47 PM   Total Posts: 1265   [ # 1 ]

you could use update method from SimpleShadow class, but way less expensive would be simply to do so: ssShadow.plane.scaleX = plateau.scaleX;

   

aeki, Member
Posted: 02 November 2011 08:43 PM   Total Posts: 73   [ # 2 ]

thank, your tip works great !!

However, it seems that there is a “bug” in the SimpleShadow class.

Indeed, it seems that the simpleshadow of a container is the “addition” of each meshes in the container.

But when i use the update method after rescaling and moving one mesh of my container the shadow, the update method just acts as moving the individual shadow of moved mesh without taking into account the global geometry of the container.

however by using your tip and just rescaling the plane i manage to achieve what i need! Thanks!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X