I’ve been supplied a 2D sketch of what my 3D world (PaperVision3D) will look like. The hardest part was matching the perspective by carefully positioning the camera. Having no other way than trial and error and a total of 7 different parameters, I quickly went nuts. This is a time consuming task: changing the values, recompiling, testing.
I wrote a tiny utility that allows you to position/rotate/zoom the camera visually, saving hours and possibly days of tweaking.
How to code it
Easily. Pass the camera object to the constructor and add the whole thing to your display list:
var cameraControl:pv3dCameraControl = new pv3dCameraControl(_camera);
addChild(cameraControl);
How to use it
Click and drag the desired text field and your camera will move, updating text field’s value. Once satisfied with the result, write down the numbers!
Also position objects
A second, similar utility I wrote allows to position objects in the viewport.
var objectControl:pv3dObjectControl = new pv3dObjectControl(viewport);
addChild(objectControl);
Click on an object in the viewport, then drag the desired text field.
Have fun.
pv3dCameraControl.as
pv3dObjectControl.as
I experiemented with PaperVision3D and JigLib last week. Since JigLib had a plugin specifically designed for PaperVision3D, making the two work together was a breeze. The only thing that really bothered me is the fact that when I applied a force on a body, it rolled instead of gliding smoothly along the surface. I’m used to 2D physics engines, so that was unexpected for me.
I found that the documentation for JigLib was pretty limited. There is only an API without any explanation as to what the methods do and a few tutorials. Oh yes, and my physics knowledge is limited, so many terms don’t mean much to me.
I spent sleepless nights in the source code, trying to figure out what everything does by myself (since nobody answered my e-mails). I stumbled upon a very nice class named “JConfig”. This was the jackpot. It had a nice property “limitAngVelocities”, which was set to 10. I set it to 0 and voilà! My objects glided nicely along the surface, colliding with each other, maintaining their initial rotation.
I hope that this will save some sleepless nights to others.
I haven’t blogged in a while. Too much work to catch after the conference.
I’m having a lot of fun with 3D in Flex lately. I found this really great open source library papervision3d. It’s incredibly easy to use. I got the hello world to run in my existing Flex app in under 5 minutes. It’s not using the native Flash 3D so it can be run in Flash Player 9.
After reading their blog, I also found out about the SourceBinding framework (currently in alpha stage). However, the following video is a must-see for all gadget lovers.
Recent comments