Letting the Character Controller collide when positioned

o hai!

I’m creating a scene where an object has a character controller that ‘swaps’ its position from one point to the other. Unfortunately, it may occur that the collision of the character controller is positioned (just a little) inside another collider. For some reason, the Character controller then decides to completely ignore this other collider, and this is currently a difficult problem for me.

Is there a (hack-y) way for me to let the Character controller still collide to this collider, instead of ignoring it?

One solution I have thought of is creating ‘layered’ colliders - the character controller might ignore the outer collider because it was just positioned in it, but still collides with a next layer or collision. But this is not really a solution to the problem, more of a way of dealing with the problem.

Cookies for answers! And… Thank you.

I guess I’ll have to go for my none-solution :frowning:

You mean some sort of teleportation ?

Yes, sometimes it may happens.

What happens exactly ? The character controller don’t bump into the collider anymore, even if the character controller move out of the second collider, and try to bump into it ?

First of all, I fixed the problem after a whole day of messing around with ray casting… Here is what I did:

//if the visual player is inside a collision, don't allow swapping
if (Physics.Linecast (transform.TransformPoint(-Vector3.right), transform.TransformPoint(Vector3.right)) ||
Physics.Linecast (transform.TransformPoint(Vector3.right), transform.TransformPoint(-Vector3.right)) ||
Physics.Linecast (transform.TransformPoint(-Vector3.up), transform.TransformPoint(Vector3.up)) ||
Physics.Linecast (transform.TransformPoint(Vector3.up), transform.TransformPoint(-Vector3.up)))
return;

So, if there is any collision near the position of the object, don’t move the Character controller there. This solves my issue :slight_smile:

Let me answer your question.

It ignores it while you’re in it. When you move the CC out of it and bump into it again, it has collision again.

Anyway, thank you for your time. :slight_smile: