I’m still finding my way around PlayCanvas, so a pointer would be highly appreciated
In the Editor UI I can see a collider class called compound
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.
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?
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?
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?
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.
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.
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.
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.