Where can I find documentation for the "Compound" collider?

I’m still finding my way around PlayCanvas, so a pointer would be highly appreciated :slight_smile:

In the Editor UI I can see a collider class called compound

image

But I struggle to find the corresponding documentation. My guess is that I can use it to create … well … compounds of various colliders (as children?) and if any of them triggers, so does the compound collider?

I played with it a bit, but couldn’t deduce the logic; hence my question. Any pointer is highly appreciated.

We don’t have documentation for it yet in the User Manual (I will add a ticket to add it).

We do have a project sample that shows the setup though.

https://developer.playcanvas.com/en/tutorials/compound-physics-shapes/

The important part is that the parent entity represents the pivot point.

Not sure about the trigger question, that’s not come up before :sweat_smile:

Thanks for the swift reply.

I will have a look at the project. Physics simulation with a compound collider doesn’t work neither in my toy project / playground; could be user-error on my part (likely is).

This opens up an interesting tangent though: How does the entity behave if there is a mix of colliders and triggers? Does it only aggregate colliders with a ridged body for physics and all of them for triggers? I don’t have any specific expectations towards this, but I think I’d really want to know what the engine does in this case to avoid gotchas.

That would be an incorrect setup as only the parent entity should be set as either a rigidBody or just a collider (trigger). The children should only have collider components that define the shape of the compound.

Can you post the project here and someone can take a look?

Aha! That’s where my mistake is; user error as suspected. That resolves all my questions. thanks again for the swift reply :slight_smile:

1 Like

That does sound like something we should protect against TBH. @will what do you think? Maybe something in the Editor that throws up a warning or just straight up removes the option?

I’m not sure exactly what you’re suggesting here. Can you elaborate?

It’s possible for a child entity of the compound parent to have rigidbody which would be an incorrect setup and give odd results at runtime:

https://playcanvas.com/editor/scene/1047319

Should be disable the ability to add a rigidBody component in the editor if it’s parent is a compound type? And/Or show a warning either at runtime or in the Editor?

hi Yaustar,
Having a compound collision + box collision child entity creates some sort of stack overflow in our current project.
image

image

A compound collider with a child box collider should work as expected. Where do you apply the rigid body (it should be on the compound collider entity)?

Try sharing some more info about your setup, and if possible a sample project that reproduces the issue.

1 Like

Now that this thread has been bumped again, we now have documentation for compound collision: Compound Shapes | Learn PlayCanvas

1 Like

Hi, here is my setup on a template I have the collision + rb.
in a child of this template I have an entity with the collision component set to box.

Below is the child collision entity

Setup seems fine, any chance you could repro the issue in a new project/forked and stripped project?

Do you have any mesh colliders in the scene?

I do not have any mesh colliders in scene, I use mostly boxes and spheres for simplicity.
I’m using colyseus implementation tho.
Removing the rigidbody got rid of the error.
But now It’s not recognizing the raycast for some unknown reason.

If you can repro the ammo crash you got with compound collision in a new project, we can see/take a look at the issue

It’s not crashing when I remove the rigidbody, but now it’s not recoginzing the raycast :(.
Same setup 1 parent compound collision component, 1 child box collision component
I can create a test project for this, but can’t at the moment I will get back with the link.

Hi @fcsa,

I can confirm that raycasts will not work on Compound Colliders that do not have a rigidbody component:

I don’t think it was ever decided whether colliders accepting raycasts without rigidbodies was considered a bug or the intended behavior.

1 Like

I believe it makes it more confusing that raycasts work on normal colliders without rigidbodies, but don’t on compound, one would think it they would work as normal ones by association.

I really needed to move forward so I ended up doing was adding a normal box collider inside the main object and communicating with its parent when raycast occured.

At the moment compound triggers are not supported.
As a workaround, you can make a series of normal primitive kinematic triggers that match the shape you need and add them as children under an entity. You can then move the parent entity, if your trigger needs to move, as it will update the children position as well.

1 Like