FIVe3D Rocks, but name is hard to type fast…

I don’t know where the capitalization came from, but it’s such a simple API for anyone who’s happy with AS3 (is there anyone who isn’t?) that FIVe3D worth the challenging finger-work. I made this demo in about 3 hours total, it draws bitmaps, and adds them to Sprite3Ds, and mimicks what we’ve been working on for 2 months in Papervision3D (I’ll definitly have a link to that when its fully launched).

For a great many simpler 3D applications, I think FIVe3D is the way-to-go, but Papervision3D still does have an edge in speed (when properly optimized that is) if dealing with more then 20 or so planes.

One quirk of FIVe3D that I initially didn’t get, was that the order of my addChild statements determines what shows up on top of what, not the Z value of the sprite, so included with this source is a handy depth sorter loop, that will work with any 53D setup.

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
FIVe3D Test Source

Also modified it a little so that height and width could be stored in the sprite3D class, i know bad me, but until i get my head around Mathieu’s version of Matrix3D. That ugly blinking plane on the right side is actually a series of bitmapDatas, that are playing back (like cached animation) that I learned from John Grden a few weeks ago. I’m working on my own version of a class to automatically create bmp animations from a timeline swf, unless his goes open source…

  • http://www.indextwo.net Lawrie

    I’d be interested to know how you made the amendments to the sprite3D class to retrieve width and height – I was slightly alarmed when I realised I couldn’t do that.

    Also, it’s worth noting that FIVe3D v2.1 has z-sorting – you just have to do some hunting through the source to find it. You just have to use mySprite.childrenSorted = true; and all your child sprites will be sorted according to z-depth.

  • http://paperclipped.com nilloc

    Thanks Lawrie, I just took a new look at the childrenSorted option and it does the same thing as mine, though mine’s might be bit more efficient, since each sprite doesn’t sort the whole sprite each frame. (though i suppose this could be solved by only setting childrenSorted on one of the sprites?)

    Example code is now up on googlecode: http://code.google.com/p/blowingthroughlines/…/Sprite3D.as

    The changes I made were basically just to set and get height to a new __height variable. Quite a hack, and doesn’t work if you have changed the height internally without setting the new value. (See lines 333-350ish)

  • http://www.indextwo.net Lawrie

    Hey – I actually completely forgot about leaving this comment until I found myself googling for ‘Sprite3D width’ again after a few months away from FiVE3D. I’m not sure if you’ve noticed, but Mathieu’s recently released a new AS3 version and an FP10 version, which I’m playing around with now.

    I took a look at your code and implemented the changes in the FP10 Sprite3D.as, but it just returned NaN, so I actually just commented out the whole public override declaration for get width() and bingo! Totally works… well, at least with what I wanted to do; I added one big container sprite and then added a rotating cube inside that. The rotating cube pushed out the boundaries of the Sprite3D that contained it, leading to a changing width value. Worked like a charm.

  • http://paperclipped.com nilloc

    @ Laurie – Cool Cool. Yeah I’ve made a bunch more changes to the Sprite3D in the FP9 version since this post, I’m gonna get them committed to my google project as soon as they are documented.

    I’m going to possibly convert the current project I’m working on over to the FP10 branch if the performance can’t be optimized by other methods. (Or worst case switch it to PV3D *hearing hand arthritis forming over background music*).