Particle with custom geometry doesn’t work.

Software: Away3D 4.x

ishaban.flash, Newbie
Posted: 22 May 2014 07:39 PM   Total Posts: 1

Hi, i’ve tryed to make particles with custom geometry (load data from asd-file), but still haven’t luck.

var loader URLLoader = new URLLoader();
   
loader.dataFormat URLLoaderDataFormat.BINARY;
   
loader.addEventListener(Event.COMPLETE, function (event Event) : void {
    initParticle
(loader.data as ByteArray);
   
});
   
loader.load(new URLRequest("coin.asd"));

...

  private function 
initParticle(byteArray ByteArray) : void {
   
//generate the particle geometry
//   var cube : Geometry = new CubeGeometry(50, 50, 10);
   
var cube Geometry ASDReader.decodeGeometry(byteArray);
   var 
geometrySet Vector.<Geometry> = new Vector.<Geometry>;
   for (var 
int 010i++) {
    geometrySet
.push(cube);
   
}
   
var particleGeometry Geometry ParticleGeometryHelper.generateGeometry(geometrySet);

   
//create the particle animation set    
var animationSet ParticleAnimati ParticleAnimationSet(truetruefalse);
   
//set the initialiser function
   
animationSet.initParticleFunc initParticleParam;

   
//create material, mesh and animator
   
var material ColorMaterial = new ColorMaterial(0xff00000.6);
   var 
particleMesh Mesh = new Mesh(particleGeometrymaterial);
   
_animator = new ParticleAnimator(animationSet);
   
particleMesh.animator _animator;
   
_view.scene.addChild(particleMesh);
  

Error:

[Fault] exception, informati Bad data: geometry can’t have zero triangles
at away3d.core.base::CompactSubGeometry/updateData()[D:\work\git\away3d-core-fp11\src\away3d\core\base\CompactSubGeometry.as:63]
at away3d.tools.helpers::ParticleGeometryHelper$/generateGeometry()[D:\work\git\away3d-core-fp11\src\away3d\tools\helpers\ParticleGeometryHelper.as:168]

If i use common geometry (e.g. CubeGeometry) all works fine, also when i create simple mesh with those geometry all works fine too. Can anybody explain what i missed? Thanks.

 

File Attachments
coin.zip  (File Size: 2KB - Downloads: 168)
   

John Brookes, Moderator
Posted: 22 May 2014 10:20 PM   Total Posts: 732   [ # 1 ]

I think asd uses normal subgeometry and the particle is expecting compact subgeometry.

Try an awd export from prefab.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X