[SOLVED] Compound shapes implementation script

Hi.

Since PlayCanvas has only basic types of collision shapes, I got a trouble with mesh-to-mesh collision.

Ammo.js (bullet physics port) has btCompoundShape class, but PlayCanvas has no implementation of that.

So I decided to write a script allows using compound shapes in PlayCanvas.

It’s pretty simple to use:

  1. Add entities with collision component and rigid body to your main entity.
  2. Place it where you need

  1. Add them tag “compound-shape

  1. Add script “compound” to your main entity

You’re brilliant!

Now you can collide with meshes: (boxes have mesh collision type)

Download from Github

If you have any suggestions or bug reports, let me know.

I really hope this script would be helpful to someone.

4 Likes

@mikefinch, I can’t see the script for collision.js. Could you send?

Compound.js, sry, my mistake

Here is it, just download it from github

Thanks a lot.:grinning:

Do the entities that you add to the main entity have to be models?

No, only collisions.

So any type of entity?

Just a plain Entity with collisions component and special tag.

So can it be a box? Sorry, I’m not exactly following.:no_mouth:

Just add entity to your car.
Then add it collision compoent, adjust it’s size and position.

So yes, it can be a box as well

The rigid body type of the boxes have to be dynamic right?

Don’t add rigidbody.
You will have only one rigidbody - your car. And this rigidbody will have compound shape.

Ok thanks a lot…

You’re welcome. Let me know if something wrong with script.

Sure, but I don’t think there will be anything wrong.

Should I share my game with you so that you know what exactly my problems are?

Do you have any one already?..

One of what are you talking about?

I meant, If you face with issue with my component, punch me and force to fix.
If it’s not, then it’s just good.