[SOLVED] Compound collision shapes do not work in projects made from blank projects

Hello everyone.
I want to use Compound collision shapes added in version 1.24.0.
However, it seems that composite collision shapes do not work in projects made from blank projects.
I added Ammo.js to the project, but Compound collision doesn’t work.

Look at this project.
https://playcanvas.com/project/655291/overview/collision-sample-a

How can I enable composite collision shapes for this project?

Oddly enough, the “Model Viewer Starter Kit” and “VR Starter Kit” do not have this problem.


Compound%E8%AA%AC%E6%98%8E6

Compound.js

var Compound = pc.createScript('compound');

// initialize code called once per entity
Compound.prototype.initialize = function() {
    this.entity.collision.type = "compound";
};

// update code called every frame
Compound.prototype.update = function(dt) {
    
};

Hi @Pandako,

Indeed I can confirm and reproduce this behavior.

I’ve tracked down the issue to the way the physics library is loaded:

  1. If I click import Ammo to get the ammo code imported in the project as assets, the compound shape doesn’t work.

  2. If I enable physics using the toggle switch (which isn’t available in the Blank Project sample), then it works.

image

I imagine this has something to do with the version of the physics library imported?

@will or @max may be able to comment on this.

1 Like

I will investigate into it.

UPD: fixed with https://github.com/playcanvas/engine/pull/1781.
Once merged and released, will be live.

2 Likes

Please try again @Pandako. It should work now (thanks to some fixes from @moka).

1 Like

Thank you everyone!:smiley:
I’ve verified that the combined collision shape works with version 1.24.2.
This problem has been resolved.:+1:

2 Likes