I’m building a cave system for my game and there are separate cave ‘houses’ that go inside it but I want them to protrude out through it like you’re walking into a dug out area in the wall.
I’m using a script to set the render queue that makes it so you can’t see the cave walls that come through but is there a way to make it so you can pass through part of a collider while the rest of it still works?
You cant make a hole in a collider, you can use multiple child objects with small colliders, or depending the case change the Collision Matrix.
I do not know if I undestand your question but I will try to help:
- When player collides with the wall
- You Disable the wall collider and when the player goes through, re enable it again;
void OnColisionEnter(Collision col) {
if (col.gameObject.tag == "Wall") {
col.gameObject.GetComponent<MeshCollider>().enabled = false;
}
}
- Then use a Coroutine or float var on update to reactivate the collider;
Hope it Works
@sporkflips