mwissink Posted January 13, 2017 Share Posted January 13, 2017 I have recently started on a Babylon project, and I have been wanting to create a capsule physics impostor for my game. I found a test demo for Oimo.js that basically achieves what I want: compound test (capsule). There are two problems: 1. due to some shortcomings in Oimo, I have had to switch to Cannon.js. 2. the demo uses Three.js and I'm sure how to exactly translate that into Babylon. I basically want to be able to combine two sphere impostors with a cylinder impostor. I'm not sure what is the best method for this, there are only a few examples that I have found, and I haven't found anything in the docs. So I created an example to show what I am talking about: capsule sandbox. I have created the capsule mesh, but I just need to figure out how to add a capsule impostor. Thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 13, 2017 Share Posted January 13, 2017 Ping @RaananW Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 16, 2017 Share Posted January 16, 2017 http://www.babylonjs-playground.com/#1TZH4F#22 Fun! This one uses box impostors... but... I think it acts pretty well. I think compoundImposters are now deprecated in the newest physics plugins, but it's still worth a playground search. Other than that, I got no help. I don't think cylinderImpostors exist. But a sphereImpostor COULD be tightly "jointed" (physics linked) to each end of a boxImpostor... creating a capsule-like shape. *shrug* Not sure. hopefully, more comments from others, soon. Quote Link to comment Share on other sites More sharing options...
dbawel Posted January 16, 2017 Share Posted January 16, 2017 Out of the box, OIMO will do what you want, as long as you declare WORLD_SCALE parameters. Otherwise, Cannon is also a good physics engine, but requires working with parameters which require a bit more tweaking. Create a PG scene, and you'll get the reponses which will solve you're issues. DB Quote Link to comment Share on other sites More sharing options...
dbawel Posted January 16, 2017 Share Posted January 16, 2017 Look at this PG: http://www.babylonjs-playground.com/#1MJ09V#9 DB Quote Link to comment Share on other sites More sharing options...
dbawel Posted January 16, 2017 Share Posted January 16, 2017 OIMO.WORLD_SCALE = 1; OIMO.INV_SCALE = 1; Quote Link to comment Share on other sites More sharing options...
mwissink Posted January 16, 2017 Author Share Posted January 16, 2017 Thanks for the responses, I will probably just continue to use the box impostor as Wingnut suggested. Quote Link to comment Share on other sites More sharing options...
adam Posted January 16, 2017 Share Posted January 16, 2017 12 hours ago, dbawel said: OIMO.WORLD_SCALE = 1; OIMO.INV_SCALE = 1; In BJS >= 2.5 the default world scale for Oimo is 1. RaananW 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 24, 2017 Share Posted January 24, 2017 COmpound impostors are your friend! Create a box, with two spheres as children, and set their impostors. this will create a single compound that will be computed as a capsule. You can also do that with point-to-point joints, which are practically the same. If I find the time later today I will prepare a quick playground. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 24, 2017 Share Posted January 24, 2017 Well, a silly demo, but - http://www.babylonjs-playground.com/#3PCLR GameMonetize, mwissink and kpgbrink 3 Quote Link to comment Share on other sites More sharing options...
mwissink Posted February 6, 2017 Author Share Posted February 6, 2017 Thanks @RaananW, this is basically what I ended up doing! RaananW 1 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.