How do I create an explode effect on a mesh?

Software: Away3D 4.x

karlperemil, Newbie
Posted: 21 March 2012 01:21 PM   Total Posts: 7

I’m guessing I need to split the mesh in to separate triangle models and animate each and one of them.

   

Ontheronix, Jr. Member
Posted: 21 March 2012 04:28 PM   Total Posts: 37   [ # 1 ]

Probably with the Explode class?

   

karlperemil, Newbie
Posted: 22 March 2012 10:20 AM   Total Posts: 7   [ # 2 ]

Explode.apply() completely destroys my UV map for some reason. I want each triangle to retain its texture the way it was.

   

Ontheronix, Jr. Member
Posted: 22 March 2012 03:42 PM   Total Posts: 37   [ # 3 ]

Can you post your code? I’m struggling with the Explode class too. Thanks.
What is it that this class do exactly in fact? Can’t figure it out precisly.

   

FJW, Newbie
Posted: 01 December 2012 01:39 PM   Total Posts: 20   [ # 4 ]

I have a sample that compiles in Away3d 3.6 and am trying to convert it to v4. Here is the complete code and I am stuck at the ExplodeAll function. Could anyone tell me how those last 3 lines should be written? On compilation its complaining of the explode.apply part. Thanks in advance for any help. F
package
{
import away3d.containers.ObjectContainer3D;
import away3d.entities.Mesh;
import away3d.events.MouseEvent3D;
import away3d.lights.PointLight;
import away3d.materials.lightpickers.StaticLightPicker;
import away3d.materials.ColorMaterial;
import away3d.primitives.SphereGeometry;
//import away3d.test.Button;
import away3d.tools.commands.Explode;
import away3d.core.base.Object3D;

import com.greensock.TweenMax;
import com.greensock.easing.Linear;

import flash.events.MouseEvent;
import flash.geom.Vector3D;

[SWF(backgroundColor=”#677999”, frameRate=“30”, quality=“LOW”, width=“800”, height=“600”)]

public class SimpleExplode extends AwayTemplate
{
  private var explodeContainer:ObjectContainer3D;
  private var sphere:SphereGeometry;
  private var light:PointLight;
  protected var lightPicker:StaticLightPicker;
  private var colShade:ColorMaterial;
  private var canReset:Boolean=false;
  private var object3D:Object3D;
 
  public function SimpleExplode()
  {
  super();
  cam.z=-1000;
  initLight();
  initGUI();
  }
  override protected function initGeometry() : void{
  setGeometry();
  }
  override protected function initMaterials():void{
  colShade=new ColorMaterial(0xFD2D2D);
  //colShade.shininess=3
  colShade.specular=2.4;
  colShade.ambient=0x127623;
  }
  override protected function initListeners():void{
  super.initListeners();
  view.addEventListener(MouseEvent3D.MOUSE_DOWN,explodeAll);
  }
  private function initLight():void{
  light = new PointLight();
  light.ambient=0.25;
  light.color = 0xCCCCCC;
  lightPicker = new StaticLightPicker([light]);
  }
  private function setGeometry():void{
  var sphere:SphereGeometry = new SphereGeometry(250);
  var mesh:Mesh = new Mesh(sphere, colShade);
  view.scene.addChild(mesh);

  }
  private function explodeAll(e:MouseEvent3D):void{
  //////remove light for performance reason///////////////
  //view.scene.removeLight(light);
  var explode:Explode = new Explode();
  unicmeshes:true;
  recenter:true;
  //Am Stuck with the last 3 lines of this
  //public function apply(object3d:Object3D):Object3D
  //explodeContainer = explode.apply(sphere) as ObjectContainer3D
  //view.scene.addChild(explodeContainer);
  //view.scene.removeChild(sphere);
 
  for each(var item:Mesh in explodeContainer.numChildren)
  {
  item.scaleX = 0.5;
  //item.bothsides=true;
  var vector:Vector3D=item.position;
  TweenMax.to(item,25,{x:vector.x*(25+Math.random()*1000-500),y:vector.y*(25+Math.random()*1000-500),z:vector.z*(25+Math.random()*1000-500), ease:Linear.easeOut, onComplete:deleteTri,onCompleteParams:[item]});
  TweenMax.to(item,12,{rotationX:Math.random()*3000-1500,rotationY:Math.random()*3000-1500,rotationZ:Math.random()*3000-1500});
  }
  //canReset=true;
  }
  private function initGUI():void{
  //var button:Button = new Button(“reset”);
  //this.addChild(button);
  //button.x=100;
  //button.y=50;
  //button.addEventListener(MouseEvent.CLICK,onButtonClick);
 
  }
  private function onButtonClick(e:MouseEvent):void{
  //if(canReset){
  //resetGeometry();
  //canReset=false;
  //}
  }
  private function resetGeometry():void{
  //view.scene.removeChild(sphere);
  //sphere=null;
  ///////////deep cleanup////////////////////
  /*for(var i:int=0;i

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X