Ammo.js Node-to-Node vs Face-to-Face Collisions

This article explains the differences between node-to-node and face-to-face soft body collision detection in the ammo.js physics engine. You will learn how both methods function under the hood, their impact on performance and simulation accuracy, and how to choose the right approach for your 3D web applications.

Soft Body Structure in Ammo.js

To understand how these collision types differ, it is important to understand how soft bodies are constructed in ammo.js (which is a JavaScript port of the Bullet Physics engine). A soft body mesh is composed of:

Collision detection determines how these elements interact when they come into contact with other physics bodies.

Node-to-Node Collisions

Node-to-node collision detection (often grouped with node-to-rigid body collisions) calculates physical contact exclusively at the vertex level.

When a collision query is run, the engine only checks if the individual nodes of the soft body have penetrated another collision shape.

Pros of Node-to-Node:

Cons of Node-to-Node:

Face-to-Face Collisions

Face-to-face collision detection (often utilized alongside face-to-rigid body collisions) operates at the polygon surface level.

Instead of checking only the vertices, the engine calculates collisions across the entire triangular surface area defined by the soft body’s faces.

Pros of Face-to-Face:

Cons of Face-to-Face:

Summary of Key Differences

Feature Node-to-Node Collisions Face-to-Face Collisions
Collision Area Only at the vertices (nodes) Across the entire polygon surface (faces)
Performance Impact Low CPU usage, highly optimized High CPU usage, potential for lag
Accuracy Lower; prone to clipping/tunneling Higher; prevents clipping through surfaces
Best Use Cases Ropes, simple soft blobs, high-performance mobile WebGL Detailed cloth simulations, flags, sails, interactive curtains