Close Show/hide page

{zero point nine} personal experiments, etc.

Cutting up a mesh (into tiny little pieces)

Thumbnail - Click me Click to run demo

A demonstration of splitting a mesh in two along an arbitrary plane. With some faux-physics for added value. I was thinking about the 'laser room scene' in Resident Evil.

This minimal example shows how to cut up the faces of a mesh along a plane:

PlaneSplitMinimalExample.as | Run it

This serves as the foundation for everything else in this demo, and for the following ideas which I think would be nice to see executed in Flash.

  • Making a more advanced intersection test using rectangles (which are bounded) instead of planes (which are infinite). The additional control would open up all sorts of fun possibilities. Projectiles or edge weapons hitting targets that get cleaved in half...
  • Adding extra faces to the cut-up meshes to make them closed shapes again would make the whole thing feel more "physical" and less abstract-graphics-demoey. And make it more useful for practical applications.
  • Maybe adding the ability to cut along an arbitrary path made up of connected line segments (like a cookie cutter)...

Make sure to try resetting the scene, pausing (with spacebar), clicking through a mesh several times, and then unpausing..

Oh yeah, and the usual disclaimer/apologies about how much this demo hates your CPU, and how unoptimized it is (e.g., right now every face in the scene is tested against the plane with every click (ouch!)). Built with the most recent revision of Papervision 3D.

UPDATE: John Lindquist pointed out there's already a helper function in the Papervision framework for cutting meshes with planes! - MeshUtil.cutTriangleMesh().

View or post a comment