character controller problem

hi folks, my problem is, that I want to prevent my character from falling down the edge of a platform. I could use an invisible wall, but I want to make it stop in its center, so my character could collide with something that's floating after the edge. Thought of various solutions but there's nothing useful coming to my mind.

Use a SweepTest or CapsuleCast that represents the character to make an imaginary clone of your character controller. At the new location (Walk distance + 0.5 seconds?), now you have a short range scanner for falling and you can recognize the problem. Probably will need to get all colliders at that place.

Here's my own capsule cast Q&A which can shine some light on a similar problem

Here's the capsule cast script reference (Requires unity 3.0 or higher)

Here's the SweepTest (which projects the rigidbody itself rather than a collider)

Remember that you need to use a little tweaking and messing around with all this just to get it right. Is there no collider at +x 10 and -y 50? Well what if there is something in between? That will complicate things with casting, so u need to force transform a certain scan position. It's kind of tricky.

Now if you aren't thinking (this is to complicated) yet. I have to tell you. It is......

Simply go for invisible wall or set the object at the edge on a script or property that denies walking. Such as a script that gets the object on it if it has a character controller and sets it as child as long as the transform is on a certain X and releases it if you try to move to the "not fall down" side.

I'm not really fully understanding your question (It could be me being a dumb a**). Let me try and understand your scene. Your character is on a floor (plane) and when he walks off, you don't want him to fall off the plane (floor)?

Could you explain your scene better?

You could increase the size of your characters collider?

. …and, again, as i always say, this is kinda thread that will
NEVER get old, as long a people make games in Unity.
*Good that admins did NOT have it closed, thanks.
So, here, (for now, and all future readers of this thread):
you need to make in CODE, and define IN CODE a Square
Matrix, after which bound player is considered out of it.
Here’s the (my simpler version) you can use, and additionally
modify, for the task
(you only MUST drag your center of your each map each time
to be 0,0,0, in coordinates, for using this script in
SUCCESSFUL manner)
So, any objects you want to limit how far, or high it can go,
just attach this script to it, and enter desired limits in Inspector:
(*you may also add your damage call line, later, as well):
here, my clean “LimitWorldBoundaries” script:
[68830-limitworldboundaries.zip|68830]