davidbeccue Posted February 27, 2017 Share Posted February 27, 2017 Hi, I imported a mesh and then separated it into two objects. Basically a wheel and a stand for the wheel. And I want the axle for the wheel to fall onto the stand and allow me to spin the wheel. My problem is that I can't get the physics to work right. I either drop things through the floor or gravity doesn't work at all, depending on the different engines and things I've tried. I'm new to babylonjs so perhaps I'm doing wrong something that's simple to see. My code is at http://www.babylonjs-playground.com/#2I8LFS#2 If anyone can see what I'm doing wrong, I'd much appreciate it! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 27, 2017 Share Posted February 27, 2017 Ping @RaananW Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 28, 2017 Share Posted February 28, 2017 Hi, To get the physics working properly you will have to run the physics code after loading the meshes. Otherwise the bodies generated using the physics engine won't be correct. To get you started - http://www.babylonjs-playground.com/#2I8LFS#5 I am not sure which mesh is mesh, but if you want to simplify the scene and add a few comments, I will be able to help better. Pryme8 1 Quote Link to comment Share on other sites More sharing options...
davidbeccue Posted March 3, 2017 Author Share Posted March 3, 2017 I tried to simplify and comment. But now I get a compilation error seemingly related to getElemetById() which I don't see anywhere in my code. And I had previously put an alert() in the code to ensure the mesh gets loaded before I let it proceed to creating imposters. But even with your fix of doing physics imposter creation at the end of the mesh loading, I don't see objects using gravity and falling to the plane. I have a simple sphere and cylinder for testing, along with my complicated mesh. And those test objects don't fall either. Must be something simple I'm doing wrong. Also am I able to use the Oimo engine in the playground? Quote Link to comment Share on other sites More sharing options...
davidbeccue Posted March 3, 2017 Author Share Posted March 3, 2017 And just to be clear, my latest code is in http://www.babylonjs-playground.com/#2I8LFS#6 Thanks for any help you can offer. Quote Link to comment Share on other sites More sharing options...
davidbeccue Posted March 3, 2017 Author Share Posted March 3, 2017 I'm also happy to pay someone to get this working for me, if anyone's interested. Just make me an offer. Quote Link to comment Share on other sites More sharing options...
davidbeccue Posted March 27, 2017 Author Share Posted March 27, 2017 So the simplified commented code is at http://www.babylonjs-playground.com/#2IOHC9#0 I don't know how to make it simpler, because the question really remains, how can I import a mesh with proper physics acting on it? Thanks for any help you might offer! Quote Link to comment Share on other sites More sharing options...
davidbeccue Posted March 27, 2017 Author Share Posted March 27, 2017 Btw, the same code works differently at http://beccue.com/cm/ than on the playground. So maybe that is a part of the problem. Note that the keys of r and l make the imported mesh spin to the right and to the left. 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.