Close Show/hide page

Cutting up a mesh (into tiny little pieces)

Thumbnail - Click me

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, LOL.

I’ve included the source code of a minimal example showing how to cut up the faces of a mesh along a plane:

PlaneSplitMinimalExample.as | compiled swf

This is the foundation for everything 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.

    Also, apologies for the long hiatus.

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

    Licensed under a Creative Commons Attribution 3.0 License.

    2 Responses to “Cutting up a mesh (into tiny little pieces)”

    1. Love it as allways!:) Have fun in NYC.

    2. C4RL05 says:

      Excellent work and thanks for the source.

    Leave a Reply