Flint Particle System Forum - Automatic Orbit Sat, 26 May 2012 06:58:53 +0100 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Automatic Orbit http://flintparticles.org/forum/comments.php?DiscussionID=540&Focus=1794#Comment_1794 http://flintparticles.org/forum/comments.php?DiscussionID=540&Focus=1794#Comment_1794 Thu, 01 Dec 2011 17:28:57 +0000 Frinkky
Anyway, I've a 3D scene where a xmas tree is generated out of static particles. I needed to set up an automated orbit. My current solution users a timer to update the orbit amount:


var timer:Timer = new Timer(41.6667);
var count:int = 31.622776601683793319988935444327;
var fcount:int = 0;

timer.addEventListener(TimerEvent.TIMER, incrementCounter);
timer.start();

function incrementCounter(event:TimerEvent) {
count++;
if (fcount < 7.5) {
fcount=int(count*count/1000);
}
if (fcount >= 7.5) {
fcount=7.5;
}
treeRenderer.camera.orbit(fcount/360);
}


It's not particularly efficient and seems quite processor intensive. Is there a better solution?

On a separate subject, I initially tried combining 2 twoD scenes and a threeD scene in one project, but received an error about not being able to convert threeD zones into twoD zones:

TypeError: Error #1034: Type Coercion failed: cannot convert org.flintparticles.threeD.zones::ConeZone@28c8b281 to org.flintparticles.twoD.zones.Zone2D.

Is this actually possible and if so, what is the usual process?

This query isn't so important because importing an external swf that contains the 3D scene works just as well for this project but it would be good to know. ]]>
Automatic Orbit http://flintparticles.org/forum/comments.php?DiscussionID=540&Focus=1803#Comment_1803 http://flintparticles.org/forum/comments.php?DiscussionID=540&Focus=1803#Comment_1803 Wed, 14 Dec 2011 19:41:44 +0000 Richard
Sorry for the delay. I've been working to get a game out before Christmas.

Flint has an orbit controller for the camera. This orbits the camera in responser to user input - pressing the left and right cursor keys orbit the camera. If you pick that code apart (there's not much of it) you should find what you're after. Here it is on Github https://github.com/richardlord/Flint/blob/master/src/org/flintparticles/threeD/renderers/controllers/OrbitCamera.as. ]]>
Automatic Orbit http://flintparticles.org/forum/comments.php?DiscussionID=540&Focus=1804#Comment_1804 http://flintparticles.org/forum/comments.php?DiscussionID=540&Focus=1804#Comment_1804 Wed, 14 Dec 2011 19:47:42 +0000 Richard
Your error message seems to relate to using a 3d zone where a 2d zone is expected, wither because you meant to use a 2d zone (there is no 2D ConeZone) or because the item that uses the zone (e.g. the Position initializer) is supposed to be the 3d version but is in fact the 2d version. If you can't fix it by correcting the imports to use the correct version, specify the exact version by adding the full path like this...

emitter.addInitializer( org.flintparticles.threeD.initializers.Position( ... ) ); ]]>
Automatic Orbit http://flintparticles.org/forum/comments.php?DiscussionID=540&Focus=1814#Comment_1814 http://flintparticles.org/forum/comments.php?DiscussionID=540&Focus=1814#Comment_1814 Thu, 15 Dec 2011 19:55:15 +0000 Frinkky
Thanks for the replies. I found moving to a DisplayObjectRenderer gave reasonable performance for that particular scenario (a ConeZone with 500 static particles inside, representing a xmas tree). I will have a crack at your suggestion just to appease my own curiosity. ]]>