Javierl Posted February 28, 2017 Share Posted February 28, 2017 Hi everyone, I'm very new to BabylonJS and to building games in general. I've read lots of resources and tried lots of things and I still don't quite know what I'm doing, to be honest but I've stumbled upon this noob question, hopefully is an easy one, even though it's not so obvious for me. So, I'm trying to build a game in which there is a character that can move around the scene. I've got a friend that is creating cool buildings with Solid Works and exporting them to STL. Managed to import them (not with pain) to BabylonJS, but then got in a bit of trouble making the character "interact" with the building (ie, a castle, I've imported it as a Mesh, should I import it as scene? by the way? what would be the difference?). Anyway, first of all, I understood that you have "two ways" of dealing with this, either using physics, or collisions. I tried first with "collisionsEnabled" and "moveWithCollisions", and I almost managed to achieve what I was looking for. My character could move and would collision with the castle, I could get in through a whole (door), and all fine. The issue comes when there are stairs or a ramp, I haven't managed to get the character walk through them. I did a lot of research and came up with the conclusion (please tell me if I'm wrong) that using moveWithCollisions wouldn't work for my purpose as without using Physics, Babylon doesn't distinguish between a wall or a stair/ramp, it's all a collision and hence the character cannot keep walking. Please tell me if I'm wrong with any of this. So, I tried to enable physics and this is where the magic begins... my building and the character were falling through the ground, and lots of crazy stuff, I'm obviously doing something really wrong. I kind of managed to move a box towards the building but it seemed to collision very soon with the castle and I've been unable to test if it can go inside the castle and through the stairs because as soon as the character gets closer to the building it does some crazy jump and disappears, I suspect might be related to the fact that I've set the castle as a BoxImpostor but I'm not really sure and still not very sure if I'm doing the right thing switching from using collisionsEnabled to enabling physics and using Oimo or Cannon, which I also heard that are way more realistic but at a performance cost. That's it pretty much, I've spent endless hours and haven't made any progress, so thought of asking for advice before investing more time to ensure at least I'm on the right track. Any advice would be very appreciated. Thank you! Regards Javier Quote Link to comment Share on other sites More sharing options...
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.