Dimitry Posted May 21, 2015 Share Posted May 21, 2015 Hello!There is a small scene imported from 3dsmax: http://sitesman.com/3dcity/1/There is a free camera there, what I am trying to achieve now is to disallow the camera to walk through the walls and objects. So the code goes like this: Scene.gravity = new BABYLON.Vector3(0, -9.81, 0); Scene.collisionsEnabled = true;camera.checkCollisions = true;camera.applyGravity = true;camera.ellipsoid = new BABYLON.Vector3(1, 1, 1);Scene.checkCollisions = true;Well and as you can see the camera goes through the walls. I feel something else should be done here, maybe I should create invisible meshes like squares and put them around the walls? Or what is the fastest method. Thanks! Quote Link to comment Share on other sites More sharing options...
davrous Posted May 21, 2015 Share Posted May 21, 2015 Hi, Nice scene. You need also to create some colliders and enable the collisions on them for that. Most of the time, we're using invisble box/meshes colliders. You can read my article to have a better understanding of what you need to do: 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 Basically, in 3DS Max: - create some boxes to match the various areas of your scene - make them invisible - enable collisions on them Bye, David Quote Link to comment Share on other sites More sharing options...
Dimitry Posted May 21, 2015 Author Share Posted May 21, 2015 Thanks David! My instincts were right then :-) 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.