Paper simulation in with AS3Dmod and Away3D
Since I released the bend modifier a lot of people have been asking how to bend an object not only along one of its axes, but along any angle. That was clearly a feature missing, but I also didn't have a clue ho to do that. Now, a after a good few days of struggle, and with a little help from my friends - here it is.
The Bend class now takes 3 arguments in the constructor, the third being the angle at which the bend is executed. Please mind, that this argument expects an angle in radians. In the code it looks like this:
-
var mesh:Mesh = [a mesh]
-
var stack:ModifierStack =
-
new ModifierStack(new LibraryAway3d(), mesh);
-
var bend:Bend = new Bend(1, .5, 1.2);
-
stack.addModifier(bend);
-
stack.apply();
Of course, there is also a getter/setter for the angle, which allows to change the value dynamically, and to use libraries such as Tweener to animate it.
The Bend modifier is now part of the AS3Dmod library. Since AS3Dmod is cross-engine, the above demo was done with Away3D, but of course, the same functionality can be used with other engines, including Papervision3D.
For those of you who remember the initial bending demo, I used a 100$ bill as a graphic element then. I thought it would fun to be consistent and to stay in the American theme. Therefore, this time you can play with the Declaration of Independence. Fans of "National Treasure" should be delighted.
As usual the sources are available and you can get them here. I hope you like the demo and that you will find the code useful. To compile it you need the latest versions of AS3Dmod, Away3D and Tweener libraries.

November 3rd, 2008 at 11:49 am
beauty! i love it :)….
November 3rd, 2008 at 12:17 pm
That’s great, well done. I alway thought there was something written on the back of the Declaration though ;)
November 3rd, 2008 at 12:22 pm
Very smooth! Well pulled off!
J
November 3rd, 2008 at 2:30 pm
You’ve just made the famous pageflip obsolete!!
Well done!
November 3rd, 2008 at 4:50 pm
I was just thinking the same thing last week. That’s awesome, and it is so smooth. Thanks for that.
November 3rd, 2008 at 5:29 pm
The is the smoothest looking paper animation I’ve seen in Flash. Great Job!
November 3rd, 2008 at 5:30 pm
przekozacka akcja!!!
November 4th, 2008 at 3:39 pm
paddy +1, I would expect something like “Bartek was here”
November 5th, 2008 at 4:50 pm
Bartek, great stuff man! Very nice.
November 5th, 2008 at 11:06 pm
WHOA! This is f’n awesome!
November 6th, 2008 at 5:51 pm
Fantastic work Bartek!!!
I wish it came a bit earlier :). We were looking for believable paper for our website and stated with your bend modifier for the floating papers but it wasn’t papery enough that’s why we went for physics.
Great job!
November 10th, 2008 at 12:49 pm
That is pretty incredible - well done!!!
November 11th, 2008 at 3:50 pm
Bartek brawo, wysylam juz skrzynie browaru kurierem prosto do Sztokholmu ;-)
November 21st, 2008 at 10:54 pm
AWSOME, and very smooth.
that’s all i have to say about this.
November 27th, 2008 at 1:18 pm
hi,
Great stuff….but i am not able to compile in my system….i got following errors.
1119: Access of possibly undefined property angle through a reference with static type com.as3dmod.modifiers:Bend.
1061: Call to a possibly undefined method sign through a reference with static type Class.
1137: Incorrect number of arguments. Expected no more than 2. ->for perlin() method
1137: Incorrect number of arguments. Expected no more than 1. ->for Bend() method
November 27th, 2008 at 2:08 pm
@gireesh you need to get the latest version of AS3Dmod from the SVN repository. It is located here:
http://as3dmod.googlecode.com/svn/trunk/
December 1st, 2008 at 7:32 pm
Very impressive. Keep up the good work Bartek!
December 12th, 2008 at 3:19 pm
I love this demo - it performs really well and looks great :-)