Away3D 4.1 パーティクル入門
-
Upload
yasunobu-ikeda -
Category
Documents
-
view
2.755 -
download
0
Transcript of Away3D 4.1 パーティクル入門
Away3D 4.1 パーティクル入門
2013-02-12株式会社 ICS 池田泰延
Agenda
• What’s new Away3D 4.1 alpha• Particle System• Official Examples• How to use• Technical Examples
What’s new Away3D 4.1 alpha
• Rendering• Materials• Particles• Performance
Rendering
Materials
Particles
Performance
PARTICLE SYSTEM
Official Examples
FLINT と Away3D 4.1 のパーティクルシステムの比較
• FLINT のほうが自由度が高い• FLINT はクロスライブラリ (Away3D だけで
はなく、 Alternativa3D も使える )• FLINT よりも Away3D 4.1 のほうが軽量
How to Use
1. ジオメトリの作成2. アニメーションセットの作成3. アニメーターの作成4. テクスチャの作成5. メッシュの作成6. アニメーションを再生
ジオメトリの作成var plane = new PlaneGeometry(10, 10, 1, 1, false);var geometrySet = new Vector.<Geometry>();for (var i:int = 0; i < 20000; i++) // ①
geometrySet.push(plane); var geometry = ParticleGeometryHelper.generateGeometry(geometrySet);
アニメーションセット /アニメーターの作成
// アニメーションセットの作成var animSet = new ParticleAnimationSet(true, true);animSet.addAnimation(…);animSet.addAnimation(…);animSet.initParticleFunc = initParticleFunc;
// アニメーターの作成var animator = new ParticleAnimator(animSet);
パーティクルのプロパティfunction initParticleFunc(prop:ParticleProperties):void{
prop.startTime = 0;prop.duration = 4;
// 1 秒間に移動する距離 ( 速度 )prop[ParticleVelocityNode.VELOCITY_VECTOR3D] = new Vector3D(
200 * (Math.random() - 0.5),200 * (Math.random() - 0.5),200 * (Math.random() - 0.5));
}
アニメーションセット /アニメーターの作成
// テクスチャの作成var texure = Cast.bitmapTexture(new BitmapData(2, 2));var material = new TextureMaterial(texure);
// メッシュの作成var mesh = new Mesh(geometry, material);mesh.animator = animator;this.scene.addChild(mesh);
// アニメーションを再生animator.start();
パーティクルの振る舞い• away3d.animators.nodes.* の「 Particle○○○Node 」クラス
で指定• 初期位置 (ParticlePositionNode)• 速度 (ParticleVelocityNode)• 加速度 (ParticleAccelerationNode)• スケール変化 (ParticleScaleNode)• スプライトシート (ParticleSpriteSheetNode)• ビルボード (ParticleBillboardNode)• 色変化 (ParticleColorNode)• 追随 (ParticleFollowNode)• etc ・・・
パーティクルの振る舞いvar animSet = new ParticleAnimationSet(true, true);animSet.addAnimation(
new ParticleVelocityNode(ParticlePropertiesMode.LOCAL_STATIC));
animSet.initParticleFunc = initParticleFunc;
function initParticleFunc(prop:ParticleProperties):void{
prop.startTime = 0;prop.duration = 4;
// 1 秒間に移動する距離 ( 速度 )prop[ParticleVelocityNode.VELOCITY_VECTOR3D] = new Vector3D(
200 * (Math.random() - 0.5),200 * (Math.random() - 0.5),200 * (Math.random() - 0.5));
}
ParticlePropertiesMode クラス• パーティクルのプロパティをどのように設定する
かを指定• GLOBAL– Node クラスのコンストラクタもしくはアニメーション
ステートで設定する• LOCAL_STATIC– パーティクルのプロパティをアニメーションセットの初
期化関数で設定する• LOCAL_DYNAMIC– パーティクルのプロパティをアニメーションステートで
設定する
Technical Examples
参考資料• http://away3d.com/tutorials/
Introduction_to_Particles