Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CANNON.Heightfield #1

Open
donmccurdy opened this issue Dec 11, 2016 · 3 comments
Open

Support CANNON.Heightfield #1

donmccurdy opened this issue Dec 11, 2016 · 3 comments

Comments

@donmccurdy
Copy link
Owner

donmccurdy commented Dec 11, 2016

Relevant to this thread: http://www.html5gamedevs.com/topic/24944-cannonjs-heightfield-from-imported-mesh/

Some discussion here: schteppe/cannon.js#221

And several github issues:

Also, docs could be improved per cannon issue 222.

@vincentfretin
Copy link

@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.

@donmccurdy
Copy link
Owner Author

@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. 🙂

@vincentfretin
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants