Mesh explode effect

Software: Away3D 4.x

Tommy, Newbie
Posted: 20 March 2014 05:24 PM   Total Posts: 4

Does enybody know how to create effect like this, i don’t know how to split sphear geometry in to separated triangles?

 

   

Avatar
Fabrice Closier, Administrator
Posted: 20 March 2014 05:41 PM   Total Posts: 1265   [ # 1 ]

Uses explode class (The explode class doesn’t “explode” as in your request )
to make each potential shared vertices unique of the (sub)geometry.

If the original position of the faces matters (for instance to go back to original location), make a copy of the original buffer and use it to calculate the new values.

On enter frame, simply loop over the indices by 3, for each of 3 vertices, multiply with a direction vector. update the vertexData, render.

This is something that you can do in matter of minutes, but if I may give you a tip if you are not familiar with this kind of code. I would create a simple waveNumber value, and increment it on each render by a small amount. then for each 3 indices, use the face normal that you muliply by the math.sin of this waveNumber. The result will be a pulsing animation that goes from all together to exploded state and back to all together (or imploded if you allow negative wave). Then once you have this pulsing animation, then add a unique direction for each face during the loop, probably using some tweening engine or whatever force that you want.

Here a very very old example http://closier.nl/playground/headexploded.swf doing the wave/explode thingy explained above

   

Tommy, Newbie
Posted: 21 March 2014 08:06 AM   Total Posts: 4   [ # 2 ]

Thanks Fabrice, can you give me code example?

   

Avatar
Fabrice Closier, Administrator
Posted: 21 March 2014 11:23 AM   Total Posts: 1265   [ # 3 ]

A code example would mean I did your work and I’m not planning to spoil the pleasure you will get out of this smile

You got the speudo code explained above.

Set up your code so it does:
- an explode pass to make sure each face vertices gets a unique index.
- access the mesh subgeometry and retreive the vertices and indices buffers.
- make a loop that adds some random factor per faces by looping over the indices per 3. (later on you will replace by your direction/force or whatever interpolated value you wish).
- update the vertexData

Then if you get stuck or have problems, post your code sample here and we’ll take it from there.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X