-
- CommentAuthorlunacity
- CommentTimeAug 12th 2013 edited
Hello,
I tried to use the logo example for a 3d space, but didn't get it to work.
I followed the example and changed all parameters for 3d. I guess my problem is with the 3D BitmapDataZone.
I guess I'm using the parameters the wrong way. Can you help me?
Here is my code. Everything works fine with the BoxZone Initializer, so I think the problem is the BitmapDataZone.
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.common.easing.Quadratic;
import org.flintparticles.common.events.EmitterEvent;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.displayObjects.Rect;
import org.flintparticles.threeD.actions.*;
import org.flintparticles.threeD.initializers.*;
import org.flintparticles.threeD.zones.*;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.renderers.*;
import org.flintparticles.threeD.renderers.controllers.*;
var logoClip : MovieClip = new Logo();
var logo:BitmapData = new BitmapData(260, 250, true, 0x00FFFFFF);
logo.draw(logoClip);
var emitter:Emitter3D = new Emitter3D();
emitter.counter = new Steady( 30 );
emitter.addInitializer( new SharedImage( new Rect( 10, 10 ) ) );
emitter.addInitializer( new Lifetime( 3 ) );
emitter.addInitializer( new Position( new BitmapDataZone( logo, new Vector3D( 0, 0, 0 ), new Vector3D( 260, 0, 0 ), new Vector3D( 0, 250, 0 ) ) ) );
//emitter.addInitializer( new Position( new BoxZone( 280, 280, 280, new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), new Vector3D( 0, 0, 1 ) ) ) );
emitter.addInitializer( new Velocity( new PointZone( new Vector3D( 0, 0, -200 ) ) ) );
emitter.addAction( new Move( ) );
emitter.addAction( new Age( Quadratic.easeOut ) );
emitter.addAction( new Fade( 1, 0 ) );
emitter.addAction( new LinearDrag( 0.5 ) );
emitter.start( );
var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight ) );
renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.66,0 ] ) );
renderer.addEmitter( emitter );
renderer.x = 0;
renderer.y = 0;
addChild( renderer );
renderer.camera.position = new Vector3D( 0, 0, -400 );
renderer.camera.target = new Vector3D( 0, 0, 0 );
renderer.camera.projectionDistance = 400;
var camera = new FirstPersonCamera( stage, renderer.camera );
camera.start(); -
- CommentAuthorlunacity
- CommentTimeAug 13th 2013
problem found! The "getLocation" function inside the BitmapDataZone Class was wrong.
I'm surprised that no one has noticed that before.
I fixed it with this code:
public function getLocation():Vector3D
{
if( _dirty )
{
init();
}
var point:Point = Point( _validPoints.getRandomValue() ).clone();
var d1:Vector3D = _scaledWidth.clone();
d1.scaleBy( point.x );
var d2:Vector3D = _scaledHeight.clone();
d2.scaleBy( point.y );
d1.incrementBy( d2 );
var pos = _corner.clone().add( d1 );
return pos;
} -
- CommentAuthorRichard
- CommentTimeAug 14th 2013
Thanks. I've added the fix to the github repository. -
- CommentAuthorlumenbeing
- CommentTimeDec 1st 2013
I get this when I try to run your code:
1067: Implicit coercion of a value of type Logo to an unrelated type flash.display:MovieClip.
1 to 4 of 4
