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:
- Add entities with collision component and rigid body to your main entity.
- Place it where you need
- Add them tag “compound-shape”
- Add script “compound” to your main entity
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.
@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
Do the entities that you add to the main entity have to be models?
Just a plain Entity with collisions component and special tag.
So can it be a box? Sorry, I’m not exactly following.
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.
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.