Interactive scene with Papervision3D (Great White)

I updated my previous experimentation with papervision3D to version 2.0 (Great White). I can say that it wasn’t too hard thanks to this John Grden article.  But is article doesn’t explain everything. A lot of things have moved since the phunky branch; as an example, Planes are now in the org.papervision3d.objects.primitives package. Once you adjusted all the package you previously used so that they can now compile, you can start playing with the new toys. I didn’t try anything fancy; I just wanted to make my materials interactive. It actually was easier than with the previous version even if I had less documentation. I didn’t quite get how to use the Interactive Scene Manager in the previous version.

So if you want to make your 3D objects interactive, you first have to advise the viewport3d object. You do it in this way:

viewport = new Viewport3D(0, 0, true, true);

The fourth parameter of the Viewport3D constructor is the one you want to set to true. Once that is done you have to make your individual materials interactive also.

var mam:MovieMaterial = new MovieMaterial(myMovie);
mam.interactive = true;
var p:Plane = new Plane(mam, 100, 100);
p.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, handleMouseOver);
p.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, handleMouseClick);

You can see that you have to set the interactive property of the material to true in order to interact with it. In the previous, I also created a plane and used the MovieMaterial on it. I then added the listeners on the plane itself. I don’t know if it is better to add the listeners on the plane or on the material but it worked fine this way, if you have more insight on this feel free to make a comment about it.

You have to import the package in order to use the 3d events. The events you can use are these ones: OBJECT_CLICK, OBJECT_OVER, OBJECT_OUT, OBJECT_PRESS, OBJECT_RELEASE, OBJECT_RELEASE_OUTSIDE , OBJECT_MOVE, OBJECT_ADDED. They are all self explanatory so I won’t explain them.

You now have everything you need to make an interactive flash movie using papervision3D, I hope I shed some light on that.


  1. #1 by Guille - June 11th, 2008 at 17:52

    I have a Question about the OBJECT_RELEASE_OUTSIDE…
    It doesn’t seem to work att all, I got:

    sphere.addEventListener(InteractiveScene3DEvent.OBJECT_RELEASE_OUTSIDE, onSphereReleaseOutside);

    and the function

    private function onSphereReleaseOutside(e:InteractiveScene3DEvent):void
    { = 1 = 1 = 1

    But nothing happens… . The other events work just fine though…
    Any ideas?

  2. #2 by flasher - September 12th, 2008 at 04:25

    I have this problem too.
    i dont know what doing

  3. #3 by Stefan - June 10th, 2009 at 11:51

    @Guille and flasher: try to do it this way:

    function myFunction(e:InteractiveScene3DEvent):void {

    If you want to tween it with TweenMax then you can do it like this in Papervision 3D 2.0:

    function myFunction(e:InteractiveScene3DEvent):void {
    e.displayObject3D.useOwnContainer = true;, 3, {blurFilter:{blurX:10, blurY:10}, ease:Sine.easeOut});

    If it does not work then try these settings:

  4. #4 by Nicolas - March 7th, 2010 at 07:29

    Thanks for this tip, i forgot to put the material interactive and the OBJECT_CLICK didn’t work.
    You save my day ;)

  5. #5 by Ryan - March 29th, 2011 at 13:08

    So… been playing around with Text3d and the graphics3d… I can not seem to figure out how to line up the text3d with my graphic container…

    like if I wanted to achieve something like this. obviously the lines represent the graphic container.

    - MY TEXT –

    Got to leave right now, but hopefully when I get back home later, someone responds! :)

    Thanks a bunch.


  6. #6 by Ryan - March 30th, 2011 at 16:38

    Maybe to expand on this a bit…

    I am creating an DisplayObject3D…
    creating the graphics3d…
    creating the Text3d…

    addChildren to DisplayObject3d…

    Handle mouse events on the DisplayObject3d…

    I can not seem to line up the coordinates from the text3d… to match up with my graphics3d…

(will not be published)
Subscribe to comments feed

Parse error: syntax error, unexpected ';' in /homepages/25/d169645162/htdocs/wp-content/themes/fusion/footer.php on line 13