Billboarding in Papervision3D 2.0 using DisplayObject2D

As mentioned on the about page Tweetpond displays tweet content using standard Flash TextFields that are rendered as part of the 3D scene. This is often called billboarding or point sprites.

Tweetpond DisplayObject2D

Our DisplayObject2D implementation is based on the following sources:

  1. DisplayObject2D by Blitz Agency
  2. Revision for Papervision3D 2.0 by Sleepy Design.

Our implementation solves the Z-ordering issues reported when using DisplayObject2D with Papervision3D 2.0.

We recently received a request to share our version with the community so here you go! You can download the ActionScript3 class files below:

This code is released under the MIT licence, same as Papervision3D. To get an idea on how to use this class please see this post by Blitz Agency and source comments.

Please feel free to share your project that makes use of DisplayObject2D below!

This entry was posted in Technology and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Posted 16 Sep 2009 at 8:08 pm | Permalink

    A reader recently asked for some examples on how to use the DisplayObject2D class so I’ve attached some example code below to illustrate.

    The magic is in having everything on their own individual layers that Papervision3D can the z-order correctly. I also highly recommend installing http://www.monsterdebugger.com/ so you can see what’s happening in your application in real time. Good luck!


    var parentLayer:ViewportLayer;
    var vpl:ViewportLayer;
     
    // create an empty parent viewport layer and add it to the container
    parentLayer = new ViewportLayer(viewport, null);
    viewport.containerSprite.addLayer(parentLayer);
     
    // create shape
    var shape = new Sphere(material, SIZE);
     
    // create layer and add to scene
    shape.useOwnContainer = true;
    vpl = parentLayer.getChildLayer(shape, true);
    scene.addChild(shape);
     
    // create text box (movieclip)
    var box = new Box();
    //...set box properties here...
     
    // create do2d that encapsulates the movieclip
    var label = new DisplayObject2D(box as DisplayObject, parentLayer, 0, null, SIZE*1.25, 0);
     
    // create layer and add to scene
    label.useOwnContainer = true;
    vpl = parentLayer.getChildLayer(label, true);
    scene.addChild(label);

  2. Fernando
    Posted 07 Dec 2009 at 6:47 pm | Permalink

    Hello from Spain,

    “A reader recently asked for some examples on how to use the DisplayObject2D class so I’ve attached some example code below to illustrate.”

    I started to program in papervision recently not for profesional job. I readed your post.

    ¿Could you give me an code source example for a movieclip like ‘circle’?

    Thank for all,

  3. Posted 09 Dec 2009 at 7:34 am | Permalink

    Hi Fernando, sounds like you’re trying to run the original example from Blitz Agency.

    “Circle” is not defined in ActionScript at all, it is a movieclip you can find in the Library of the DisplayObject2DTest.fla project:

    DisplayObject2d Library: Circle

    You will also notice under the “linkage” column how this movieclip has been exported to ActionScript as class “Circle”. In the Library, right click on the Circle and select Properties to view and change symbol properties.

    Hope this helps.

    Cheers, Jussi

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>