Sliding collision

I have a project which i need to move the world and character stands at 0,0,0 thus i cant use physics or even charactercontroller.

I have a moveDirection vector which is just an Input value. And then i try to calculate a projection vector when there is a collision;

But the collision goes wild and unpredicted. Does anyone know how the character controller sliding is calculated? Or any other solution?

yes trow the CharacterController in the bin and write a simple script that does the job :wink: (not a fan of the CC)
so you need to do what exactly?
-move an Object
-calculate the direction to go in after a collision
is that about right?

Like i said, i move the whole world and character stays in place (0,0,0) so i cant use CC or any other physics, not that anything wrong with CC.

The question is, what is the best way to do sliding collision in Unity without using physics engine or CC itself.
Though, my answer lies inside the code for CharacterController as it has perfect sliding collision already, but no code.

Does this help? Custom Character Controller in Unity: Part 4 – First Draft | Roystan Ross
tl;dr

You can get his final code from github

Sounded like it, but i examined the github project and its just too much overkill for what i need.

ah yes i see, i got confused because you asked about the character controller assuming you wanted to adjust it. while you just want similar behaviour :slight_smile: sorry… i should reply to questions so late at night :wink:

maybe you can try adjusting a physics material to try and control the collision.
other option could be spreading out your collision readings and smooth the result between readings?

Well, i fixed it by calculating against all collisions and not only contacts[0]
Now it slides great.