Open donmccurdy opened 7 years ago
@donmccurdy I created a Heightfield shape for the environment component https://github.com/feiss/aframe-environment-component/pull/24 The environment component uses a THREE.PlaneGeometry where we modify the z of all vertices. I don't think we can generalize the work I did to put in three-to-cannon, but anyway it can inspire others.
@vincentfretin that's great!
I agree it probably doesn't generalize to support any Mesh (I'm not planning to solve that case, at this point) but it would be helpful if three-to-cannon was able to do:
var shape = mesh2shape(object3D, {type: mesh2shape.Type.HEIGHTFIELD});
// succeeds if object3D contains exactly 1 PlaneGeometry, else returns null and logs error
I'd be glad for a PR doing just that, if you're interested. 🙂
Hey, you're right, I'll probably do that. This way I won't put lots of changes in the environment component and I'll probably do an option to enable the heightfield, disabled by default.
Relevant to this thread: http://www.html5gamedevs.com/topic/24944-cannonjs-heightfield-from-imported-mesh/
Some discussion here: https://github.com/schteppe/cannon.js/issues/221
And several github issues:
Also, docs could be improved per cannon issue 222.