Sign in to follow this  
mwissink

Capsule Impostor with Cannon and Babylon

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.