Hullo Unitys, seem to be having a slight problem with the CharacterController and need a workaround. Been building a platforming game, but having trouble with slopes. Just realized that while the character controller can slide along colliders on it’s horizontal axis, it doesn’t slide down slopes on the vertical axis.
so if I do
controller.Move(moveDirection * Time.deltaTime);
and if my moveDirection.y is -1000, if the character is just touching a slope at a 60 degree angle, he doesn’t move at all.
This is probably good for the majority of the time where you don’t want your character pushed down slopes, but when a slope is too steep for the character to climb I want him to just ignore it on the y axis and slide down.
For the visually inclined…
With the red vector being what I want.
Hmm, just realized after explaining it all like this I actually have a better grasp of how to find a solution, probably has something to do with Trig. However, this seems like it could be a common problem (can’t make a platformer without slopes!) so hoping someone has a cut and dry solution.
Hmm…been working at it but I think I’m going about the wrong way, and I realized I don’t need the character to actually slide down the slope; I just need him to act like he’s hitting a vertical wall when he’s hitting a slanted collided. The reason it has to be slanted, unfortunately, is because there are mountain surfaces that are angled by I want to “act” like vertical walls.
What would be perfect is if I could get the collider to only register for the sides of the CharacterController. So when he runs and jumps up to a slanted wall, he would be pushed backwards (but not upwards)…like so.
Obviously on a much smaller scale than the drawing…
I’ve thought it through and I think it would work fine…but I have no idea if it is possible or not to disable collisions like this or if there’s a clever workaround.
I don’t want to have to manually move the controller, because I want the player to have the same jumping control over the character when he’s colliding with the slopes as when he’s not colliding…hope I made it clear enough.