Home > other >  Colllision is being ignored between 2 colliders
Colllision is being ignored between 2 colliders

Time:03-29

So I have a pressure pad. If I step on it a door opens. And same thing with placing a cube on it.

Problem: if I place a cube, player steps on at the same time and then gets off, door closes, completely ignoring the cube.

I tried using on collision stay, and on collision enter

Here is my code

PressurePad.cs photo

CodePudding user response:

How about using a list of items that are on the pad? You can add every item (the cube or the player) that falls on the pad into the list and then remove the item when it exits? This way you could play the open animation only when the list is initially empty, and the close animation only when the last item is removed from the list!

Also, don't forget to add rigidbody component onto your cube.

CodePudding user response:

Sorry, I fixed the bug. The issue was that the cube has a rigidbody, and it always was "Asleep" so I made a script, that set the cube to awake everytime it was asleep. This is less performant but whatever lol

  • Related