Collisions Question

My students have a question for me. They are building a game for my class.

They want to make a wall that the camera can go through but an item or object that is moving cannot. They have made a game where a monster chases the player. They want a small zone that the monster cannot cross. Basically, 0% opacity walls that items collide with but the player/camera does not.

I feel like this would be easy to code but I’ve played with the CoBlocks for a while and can’t figure it out. Any help would be awesome!

Hi @Abigail_Bowe1, if you want pass through objects with camera you need tu unflag collision in camera menu like this:

Hope this helps and if this solve please please mark as solution,
Bye Giuseppe

Hi @Abigail_Bowe1,

You can add a little bit of Typescript code to allow the Camera to go through an object:

// This code allows the Camera to pass through a wall 
// without the Zombie following
const wall = Scene.getItem("AuwVkmzu") as Cuboid;
Camera.addToCollisionFilter(wall);

You can try this yourself in this CoSpace:

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

Many thanks,
Geoff @ TechLeap