I updated my previous experimentations 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:
Actionscript:
-
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.
Actionscript:
-
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 org.papervision3d.events.InteractiveScene3DEvent 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.