Problem with CollisionFilter in combination with physics?

I’m trying to make a door opening which acts as a trigger (play a sound for now) that the main camera can go through but other objects can not pass through. [This] is the cospace I am working on.

When you press Spacebar a ball shoots in the direction the camera is looking. I used that to test whether a ball bounces off the door opening. Sometimes such a ball goes through and sometimes they bounces away (what I intended to happen). What can I do differently to make it work better?

1 Like

I fixed your problem.
You can take a look at the photo but make sure you read the instructions I wrote below this.

  1. I got rid of the MOVE KOGEL 1 METERS FORWARD IN ZERO SECONDS.
  2. I got rid of the MOVE KOGEL 1 METERS DOWN IN ZERO SECONDS.
  3. I added a SET KOGEL COLLISIONS WITH OTHER ITEMS = ON.
  4. I added a SET TRIGGER COLLISIONS WITH OTHER ITEMS = ON
  5. I elongated the 3D square ‘trigger’ backwards and down. You do not need to change the opacity of ‘trigger’, I just changed it so that you can see the difference.
  6. You may see that I changed the WHEN SPACEBAR IS CLICKED to WHEN TEXT IS CLICKED; you do not need to do this. I just did it because I was using an iPad at the time.

Some balls still might go through, but that is a glitch in there is nothing you can do about that.

So that’s it! I hoped it helped!

I also just have one quick question for you, how did you make it so that the camera can walk through that brick? Thank you!

1 Like

Hi @Chris, just reduce your ball velocity by half. CoSpaces can have FPS/Physics glitches if things are moving too fast for the computer.

Hope that helps! Let me know if you have any questions. If this resolves your problem, please mark this post as the Solution.

Cheers,
Geoff @ TechLeap

Thanks for the effort. The glitching seems to be the problem.

To make it possible for the camera too walk through the brick and textitem I used the following Typescript:

//Find the item to be added to the collision filter
let trigger = Scene.getItem("trigger");
let tekst = Scene.getItem("MqmitwtA") as TextItem;

//Add the item to the collision filter
Camera.addToCollisionFilter(trigger)
Camera.addToCollisionFilter(tekst)
1 Like

Thank you! This helps a lot.