Nape Samples are intended to both demonstrate the capabilities of the engine, as well as demonstrating how to use the engine through practice. All samples have documented source in AS3/Haxe to accompany them.

Getting Started.

These samples are specifically intended to demonstrate the basics of using Nape. All code for the samples is self-contained with no additional utilities being used.

BasicSimulation FixedDragging
Setting up a basic Nape simulation with debug drawing. [BasicSimulation] Fixed time-step simulations and dragging objects with mouse. [FixedDragging]

Feature Demonstrations.

Samples make use of a Template class to hide common code and focus on features. Download samples to view this class.

FilteringInteractions Constraints PerlinSquares
Filtering collisions and other interaction types. [FilteringInteractions] Demonstrating all built-in Nape constraints. [Constraints] Demonstrating MarchingSquares and polygon decompositions. [PerlinSquares]
SpatialQueries SoftBodies PyramidStressTest
Convex casts, Ray casts and spatial sampling of Space using Circles AABBs and Shapes [SpatialQueries] Creating Soft Bodies through use of Constraints and additional logic. [SoftBodies] Stress testing physics collisions, huge pyramid, large number of iterations! [PyramidStressTest]
Viewports MarioGalaxyGravity OneWayPlatforms
Using callbacks system for viewport logic. [Viewports] Using methods of Geom and additional logic to create Mario Galaxy style gravity effects. [MarioGalaxyGravity] Creating one-way platforms, demonstrating conveyor belts and kinematic bodies in addition. [OneWayPlatforms]
BodyFromGraphic DestructibleTerrain Portals
Using MarchingSquares to generated Nape Bodies from Bitmaps and DisplayObjects. [BodyFromGraphic] Using MarchingSquares to create efficient destructible terrain using a Bitmap. [DestructibleTerrain] Very complex demo, creating general purpose Portals with callbacks and UserConstraint. [Portals]