chandlerprall/Physijs — pull request #36 by troublehoff (2012-07-31 21:32:09+00:00)
Title: Physijs.HeightfieldMesh

I've added the HeightfieldMesh to your library

```javascript
Physijs.HeightfieldMesh = function ( geometry, material, mass, xdiv, zdiv) {
```

This is created by passing a THREE.PlaneGeometry, material and mass parameter.

Example:

```javascript
this.terrainGeometry = new THREE.PlaneGeometry(this.worldWidth ,this.worldWidth , this.groundMeshSegments, this.groundMeshSegments);

// create terrain by setting y component of vertices in mesh
this.createLandscape();

// now wrap in a physics object after we've sculpted the mesh..
this.terrain = new Physijs.HeightfieldMesh(this.terrainGeometry, ground_material, 0);
```

Things to note:

* xdiv and zdiv are optional parameters, and not required if the plane is square. They should represent the number of segments in the x and z axes as this data is not explicitly carried with the THREE.PlaneGeometry object.
* only tested in a world where the y-axis is up