-
Notifications
You must be signed in to change notification settings - Fork 457
Basic Shapes
chandlerprall edited this page Nov 27, 2012
·
4 revisions
Physijs currently supports 9 shapes:
-
Physijs.PlaneMesh
- infinite zero-thickness plane -
Physijs.BoxMesh
- matchesTHREE.CubeGeometry
-
Physijs.SphereMesh
- matchesTHREE.SphereGeometry
-
Physijs.CylinderMesh
- matchesTHREE.CylinderGeometry
-
Physijs.ConeMesh
- matchesTHREE.CylinderGeometry
(tapered) -
Physijs.CapsuleMesh
- matchesTHREE.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
andPhysijs.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