chandlerprall / Physijs

Physics plugin for Three.js
MIT License
2.77k stars 455 forks source link

Physijs.HeightfieldMesh error when xdiv !== ydiv #269

Open SET001 opened 8 years ago

SET001 commented 8 years ago

Seems like Physijs.HeightfieldMesh does not allow to create mesh with different height and width -

http://jsfiddle.net/u1mps219/1/

The erorr is VM106 physi.js:1126Uncaught TypeError: Cannot read property 'z' of undefined

I don't know if this is how it intended to work, but if yes then maybe xdiv and ydiv should be replaced with single parameter with something like divSize?

aleciavogel commented 7 years ago

Refer to this excerpt from the comments of a heightfield example...

If your plane is not square as far as face count then the HeightfieldMesh takes two more arguments at the end: # of x faces and # of y faces that were passed to THREE.PlaneMaterial