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 i : int = 0; i < 10; i++) {
geometrySet.push(cube);
}
var particleGeometry : Geometry = ParticleGeometryHelper.generateGeometry(geometrySet);
//create the particle animation set
var animationSet : ParticleAnimati ParticleAnimationSet(true, true, false);
//set the initialiser function
animationSet.initParticleFunc = initParticleParam;
//create material, mesh and animator
var material : ColorMaterial = new ColorMaterial(0xff0000, 0.6);
var particleMesh : Mesh = new Mesh(particleGeometry, material);
_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.