Dud Posted August 1, 2015 Share Posted August 1, 2015 Hi all, I'm a complete beginner with Babylon.js but it looks a very promising framework. I'm interested in making a crazy golf type game and was planning to model some simple golf holes using Blender. My idea was to model a simple rectangular style floor with a cylindrical hole. I'd like to then import such a model using Babylon.js and I was hoping that I could apply a mesh collider to the object so that if I were to place a golf ball on the floor and apply a force I could see it drop through the hole. Is this something Babylon.js could support? I've looked through the documentation but did not specifically see any mention of a mesh collider which I think is what I would need here. I get that I could approximate something using box colliders but I'd like something more accurate if possible. Unity supports mesh colliders as does PlayCanvas - but I'd rather use Babylon.js if I can. Can anyone tell me if they think this would be possible using this framework? I apologise in advance if I have missed something obvious in the docs! Thanks,Dud Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 1, 2015 Share Posted August 1, 2015 Hey! and welcome!Babylon supports two physics frameworks (Oimo and CannonJS) that will do what you are asking (i guess? :-) ).check this out, might be a good start - http://blogs.msdn.com/b/davrous/archive/2014/11/18/understanding-collisions-amp-physics-by-building-a-cool-webgl-babylon-js-demo-with-oimo-js.aspx Quote Link to comment Share on other sites More sharing options...
Dud Posted August 1, 2015 Author Share Posted August 1, 2015 Thanks for the info - but digging around its still not clear if Mesh Colliders are supported or not. Whilst the article you linked to talks about Mesh Colliders the screenshot is from Unity. Searching through the docs there does seem to be a MeshImposter type but looking at the SetPhysicsState method on the AbstractMesh class the description says the pyhsics imposter can only be "The physics impostor Sphere/Box/Plane" which leads me to believe that Mesh Colliders aren't yet supported. Can anyone else confirm this? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 2, 2015 Share Posted August 2, 2015 Maybe you could look with intersectMesh () that detects object collisions with other. All objects can detect collisions in babylon, without the use of physical, but if you need to bounce physics will be essential. Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 2, 2015 Share Posted August 2, 2015 I confirm, Mesh colliders are not supported for oimo.js. However, they are supported for cannon.js with MeshImpostor . Be careful, it's very (very very) CPU intensive! intersectMesh uses bounding volumes, and thus are not pixel perfect. Quote Link to comment Share on other sites More sharing options...
Dud Posted August 2, 2015 Author Share Posted August 2, 2015 Thanks for the confirmation, I think I'll have to go with Unity and try their WebGL export instead. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 2, 2015 Share Posted August 2, 2015 Babylon has an export babylon for unity 5 which would be much better than the export webGL : https://github.com/BabylonJS/Babylon.js/tree/master/Exporters/Unity%205 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.