Flint Particle System Forum - RotateVelocity(Vector3D.Y_AXIS, Math.PI / 2) doesn't work. Mon, 12 Dec 2011 03:51:12 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher RotateVelocity(Vector3D.Y_AXIS, Math.PI / 2) doesn't work. http://flintparticles.org/forum/comments.php?DiscussionID=423&Focus=1449#Comment_1449 http://flintparticles.org/forum/comments.php?DiscussionID=423&Focus=1449#Comment_1449 Sat, 04 Dec 2010 10:57:12 +0000 egatuz
package
{
import com.greensock.TweenMax;
import com.greensock.events.TweenEvent;

import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Vector3D;

import id.web.ega.Kotakan;

import org.flintparticles.common.particles.Particle;
import org.flintparticles.threeD.actions.Rotate;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.initializers.RotateVelocity;
import org.flintparticles.threeD.particles.Particle3D;
import org.flintparticles.threeD.particles.Particle3DUtils;
import org.flintparticles.threeD.renderers.DisplayObjectRenderer;

/**
*
* @author ega
*
*/
public class Main extends Sprite
{
private var rotationVelocity:RotateVelocity;

private var tw:TweenMax;

private var particle:Particle3D;

private var imageParticles:Vector.;

private var renderer:DisplayObjectRenderer;

private var emitter:Emitter3D;

private var kotakan:Kotakan;

/**
* Constructor.
*
*/
public function Main()
{
kotakan = new Kotakan;
emitter = new Emitter3D;
renderer = new DisplayObjectRenderer;

rotationVelocity = new RotateVelocity(Vector3D.Z_AXIS, Math.PI / 2);

emitter.addInitializer(rotationVelocity);

emitter.addAction(new Rotate);

renderer.camera.dolly(-400);

renderer.addEmitter(emitter);

addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}

private function onAddedToStage(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

kotakan.addEventListener(Event.COMPLETE, onFotoComplete);

addChildren();
}

private function onFotoComplete(e:Event):void
{
kotakan.removeEventListener(Event.COMPLETE, onFotoComplete);

imageParticles = Particle3DUtils.createRectangleParticlesFromBitmapData((kotakan.content as Bitmap).bitmapData, 10, emitter.particleFactory);

emitter.addExistingParticles(imageParticles, true);

draw('start');
}

private function onTwComplete(e:TweenEvent):void
{
emitter.stop();
}

private function onTwStart(e:TweenEvent):void
{
emitter.start();
}

protected function addChildren():void
{
addChild(renderer);

draw();
}

public function draw(args:String='null'):void
{
switch(args)
{
case 'particle':
tw = new TweenMax(particle.rotation, 5, {y: 180});
tw.addEventListener(TweenEvent.START, onTwStart);
tw.addEventListener(TweenEvent.COMPLETE, onTwComplete);
case 'start' :
emitter.start();
}
}
}
} ]]>
RotateVelocity(Vector3D.Y_AXIS, Math.PI / 2) doesn't work. http://flintparticles.org/forum/comments.php?DiscussionID=423&Focus=1477#Comment_1477 http://flintparticles.org/forum/comments.php?DiscussionID=423&Focus=1477#Comment_1477 Thu, 16 Dec 2010 08:36:02 +0000 Richard
e.g.
renderer.camera.position = new Point3D( 0, 200, -300 );
renderer.camera.target = new Point3D( 0, 0, 0 );


Meanwhile, if you need full 3D perspective, you should use the Away3D renderer and use full 3D objects. (N.B. If you use Away3D sprites you again won't see the rotation.) ]]>