Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorFrinkky
- CommentTimeDec 1st 2011 edited
I just stumbled across Flint last night. I'm certainly no as3 developer (I tend to get roped into flash work once a year by one particular client for their e-cards). I have enjoyed experimenting with Flint however.
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. -
- CommentAuthorRichard
- CommentTimeDec 14th 2011
Hi
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. -
- CommentAuthorRichard
- CommentTimeDec 14th 2011
P.S. It should be possible to use 2d and 3d effects in the same swf, but you have to be careful about package names. Some items in the 2d and 3d packages have the same name, so if they're used in teh same file you'll need to specify the full package name along with the class name.
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( ... ) ); -
- CommentAuthorFrinkky
- CommentTimeDec 15th 2011
Hi Richard,
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.
1 to 4 of 4
