Papervision 3D Programming Tutorial - Mesh Splitting

Posted Feb 23, 2009 by mcasperson / comments 0 comments / Print / Font Size Decrease font size Increase font size

See how you can use the Papervision MeshUtil.cutTriangleMesh function to split a mesh into two parts. Demo and source code included.

VIEW THE DEMO
DOWNLOAD THE CODE

New to Papervision 2.0 is the ability to slice a mesh into two parts. If you have every watched the movie Cube then you'll have an idea what I am talking about :). Seriously though, this does have some neat uses. In fact the first time I became aware of this functionality was because of a Papervision demo that allowed you to smash up a pane of glass and then have it shatter and fall to the ground. Unfortunately I can't find the demo again (I'll link to it here if I ever do find it), but it did pique my interest.

This sample application is a little simpler. It shows you the steps you go through when splitting up a mesh. The first stage is to display a regular old mesh. You'll then see a plane showing where the cut will take place. Then we make a call to MeshUtil.cutTriangleMesh, supplying it with the original mesh (any TriangleMesh3D class will do, and our Quake II MD2 model fits that bill) along with the splitting plane. Finally the two new meshes are displayed independently.

While it seems fairly trivial, this process could be used in many ways. You could show a space fighter being destroyed by randomly slicing it up a few times and then having the various pieces explode. You could also use it to demolish a wooden door into a number of splinters with an explosion. As always the possibilities are limited by your imagination (and a low polygon count :P).

Go back to Papervision Tutorials

Rate this Article:

Be the first to rate me.


* You must be logged in order to leave comments, please login or join us.

Comments

No comments yet.



Bookmark and Share
Sign up for our email newsletter
Name:
Email: