Basic Shapes

chandlerprall edited this page Nov 27, 2012 · 4 revisions

Physijs currently supports 9 shapes:

  • Physijs.PlaneMesh - infinite zero-thickness plane
  • Physijs.BoxMesh - matches THREE.CubeGeometry
  • Physijs.SphereMesh - matches THREE.SphereGeometry
  • Physijs.CylinderMesh - matches THREE.CylinderGeometry
  • Physijs.ConeMesh - matches THREE.CylinderGeometry (tapered)
  • Physijs.CapsuleMesh - matches THREE.CylinderGeometry, except has two half spheres at ends
  • Physijs.ConvexMesh - matches any convex geometry you have
  • Physijs.ConcaveMesh - matches any concave geometry you have, i.e. arbitrary mesh
  • Physijs.HeightfieldMesh - matches a regular grid of height values given in the z-coordinates

Using any of these shapes is as simple as replacing THREE.Mesh in your code with whatever Physijs mesh best suits your geometry. You add these meshes to the scene the same way you normally do, scene.add( mesh_object ). There is an event you can listen for, described under Adding an object, which is triggered when an object has been added to the physics world.

Look at the shapes example to see creating & adding shapes in action.


  • Use Physijs.ConcaveMesh sparingly, it has the worst performance
  • THREE.PlaneMesh and Physijs.PlaneMesh are not strictly analogous as the latter is infinite. A very thin BoxMesh can better represent finite planes.
  • Physijs.CapsuleMesh is usually good for humanoid player characters
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.