Deactivated collision components still effecting physics unless deleted

Started up my project this morning to find that the ‘triggerenter’ event wasn’t firing to the collider components on objects, effectively breaking the game. I found it odd as objects with rigidbodies were still getting collision events, so the physics was still working.

After trying a vast variety of things, I found the issue and have been able to replicate it in a project I will link to.

Here is the issue: if the trigger volume is attached to (or is a child of) an entity with a collision component that is set to the ‘compound’ type, regardless of whether the component is ON or OFF, will break trigger volumes and the event will not send. Only if you delete the compound collision component, will the trigger volume work as expected.

Here is my experiment:

  • In a blank scene I have a plane, 2 boxes, 2 parent entities and a sphere.
  • Sphere has a sphere collider and a dynamic rigidbody to fall into trigger volume.
  • Plane has a box collider and a static rigidbody acting as a floor.
  • Box is the trigger volume with a box collider, and a script that detects a ‘triggerenter’ event on the collision component and logs “meep” to the console.
  • one parent entity has no components, the other has a compound collision component and a rigidbody component (both of which are OFF).
  • one trigger volume is parented under each of the parent entities
  • Enable the parent entities one at a time. Run the game and observe

Result if only the parent with no components is enabled:

Result if only the parent with deactivated components is enabled:

Here is the link to the public project: link to project. This scene is called physics

Yesterday the project had no issues, so something had to change in the last 12 hours to mess with the system. Luckily I was able to replicate it, but it’s super frustrating when inactive components breaks the game when, in theory, it should act as if it’s not there.

Hi @ChaosPhill! Are you sure it is a problem with the collision component, because a trigger entity will not act as a trigger if a rigidbody component is added, even if it is disabled.

1 Like

I too think that this is the intended behaviour.

If you add a compound collider to an entity, all collider of all children, grand children, etc. of this entity are going to be a part of the same compound collider. If you add a rigidbody the parent entity, they all will cease to be just trigger volumes and become physical objects. There is no need to add a rigid body to each individual child collider, as it would be tedious to keep them all in sync regarding mass, friction, etc.

2 Likes

Hi!
Pretty sure it’s not that. If I remove the deactivated compound collision component on the parent, but keep the deactivated rigidbody component on the parent, the trigger volume works

Just to reiterate, I’m well aware of how the components work together.

My issue is that this hasn’t been an issue for months, but now suddenly nearly made the project I’m working on unplayable. I just want to know what changed between yesterday and today that would have caused this to happen.

Maybe I didn’t properly understand your question, so I’m trying to paraphrase the problem:

  • A compound collider without a rigidbody should combine all it’s children and form a compound trigger volume.
  • A compound collider with a rigidbody should combine all it’s children and form a compound collider.
  • A disabled compound collider with a disabled rigidbody should behave as if they were not existent at all, and all the child collider should work independantly of the parent.

It sounds to me like point 3 is the one that is not working as expected, and even though the compound collider is disabled, all child collider are still added to the compound. Is this the issue you are facing?

1 Like

Yes, that is exactly the issue.
I’m not sure if changes were made between yesterday and today to PC, but I never got that issue before today.

You could try to check the release notes of version 1.46.2.

Hmm, I’m not sure what the intended behaviour would be in the case of disabled components. Maybe @yaustar can give us some more insight?

Forked the project: https://playcanvas.com/editor/scene/1223195

This setup is working as I expect it to:

In terms of physics components, it doesn’t matter that they are disabled. This is setup
image

Where WithOFFComponents setup is making it’s hierarchy a compound kinematic object where box is part of the compound shape and not a trigger. But as the components are disabled, the rigidbody is not present in the physics world/sim so the sphere goes through the box.

I tested this setup with an older release (1.45.0) and it behaves the same there: https://launch.playcanvas.com/1223195?debug=true&use_local_engine=https://code.playcanvas.com/playcanvas-1.45.0.js

1 Like

Thank you for your reply. I will make sure to be more careful with my components.

However, it still doesn’t explain how this issue didn’t pop up earlier. I have builds where the game is fully operational, where your expected outcome would have made the game unplayable. I have a build that uses v1.46.1 revision 49b2ea2. Unfortunately due to NDA, I can’t link to the build publicly, but is there a way to play the above experiment with an older version outside of the launcher context?

Not sure what you mean by this?

Without a repro/example project, unfortunately I can’t really advise. Can you take part of the setup/scene/etc into a public/private project to look at?