veggis Posted November 1, 2017 Share Posted November 1, 2017 I've been looking for a framework for an idea i have. I want to create a 2d platformer with 3d objects for web and mobile. Babylon is attractive, but i'm unsure if there are any physics engine that can handle constraints and also suitable for a platformer in that way. Any ideas? Is unity the best way to go here? Thanks Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 1, 2017 Share Posted November 1, 2017 If everything's missing is a physics engine, we do have it. But those are 3d physics engine (oimo and cannon.js). There are many 2D physics engines, but they need to be integrated with the framework (or be integrated externally), and you will also need to make sure the "3d dimension" is staying constant, so it will eventually stay 2D. Quote Link to comment Share on other sites More sharing options...
Raggar Posted November 2, 2017 Share Posted November 2, 2017 You might be able to use a 2D physics-engine like the following(p2.js): https://jsfiddle.net/oagn4jvz/2/ First time trying out p2.js, so it does have some odd behavior. WAD to jump/left/right. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
vtange Posted November 2, 2017 Share Posted November 2, 2017 I would take my time and look at 2D game engines first if you're thinking anything along the lines of focusing on sprites that move in a X-Y plane. IMHO using Babylon.js for a 2.5D game like what's discussed here http://www.html5gamedevs.com/topic/22268-25d-beat-em-up-jump/ would be overkill since you're not taking advantage of a lot of what BJS has to offer. If you're thinking something like Super Mario 3D world but you only move in 2 directions Left Right Jump/etc. then yeah it's pretty much oimo, cannon or the default. Quote Link to comment Share on other sites More sharing options...
Raggar Posted November 2, 2017 Share Posted November 2, 2017 Here's Schteppe's Platformer example with BabylonJS(top) and Canvas(bottom). Once again WAD to jump/left/right. https://jsfiddle.net/oagn4jvz/6/ So it is certainly doable. But whether or not it's better than simply limiting z-axis velocity/position in a 3D physics-engine. Well. I have no idea. It's a bit messy, and uses 2 separate loops, but you get the idea. Quote Link to comment Share on other sites More sharing options...
veggis Posted November 2, 2017 Author Share Posted November 2, 2017 @Raggar @vtange Great examples! This is definetity what i'm looking for. I'm thinking it would probably be easier to implement it with a 3d phsyics engine. But probably better performance wise with something like p2. Im not sure. Thanks everyone! Quote Link to comment Share on other sites More sharing options...
pf17 Posted November 3, 2017 Share Posted November 3, 2017 I read somewhere from a 2d camera or 2d layer, is there such a thing in babylonjs? or I have to build myself?2d camera would be great for my project. 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.