Unity working with slopes and ramps in a platformer - Help!

Hi everyone i posted a topic with the slope limit issue i was having but now i’m just not sure what i should be doing.

I want my game to have levels that come from my modeling software which is blender.

I put the level model in and everything is fine, now when i use my character in this level i can walk up any slope that is not 90 degrees i have tried every setting in the character controller but nothing works.

Now i am starting to get desperate, i want the games slopes to work so that if i am a certain character i will slide down slopes that are at x degrees and if i am a diffent charcter i will slide down slopes that are y degrees.

What do you recommend i do as i’m lost with what to do at this point and can’t find any answers i’ve been stuck on it for a while now and need help.

I’m starting to feel that all the effort i’ve put in to modelling and animating is going to go to waste because of this problem.

I’m at work and can’t test anything plus i don’t have a project to try it out with but i’m guessing one of two things. Either you need to make sure gravity is affecting the player so that you will be pushed back down a slope or the character controller is too restrictive for what you need. In which case you’d have to write your own controller script.

Thanks just getting a reply makes me feel instantly better.

Atm i don’t use physics as my character does not have a rigided body and is using the character controller alone. Writting my own script that handels all these things would probably be too difficult for me at them moment as i’m new to Unity.

With rigided bodies i have to apply forces to push the character rather than using the transform of the character (thats correct isn’t it?). But i don’t really understand how i would handle the slopes and making the character slide down the incline etc.

Thanks again for your reply and posting while you were at work. If you can give me some more advise, a script, project or link to a tutorial i’d appreciate it alot!

Looking at the documentation i don’t think you will be able to achieve what you want with the character controller it doesn’t get affected by physics so sliding down a slope is not going to work.

I’d suggest taking a look into using a RigidBody instead, if you get stuck then head over to the scripting section and ask for help, someone may even have an example that works for you if you don’t want anything too complicated.

Unity 3 fixes the slope climbing issue but as far as I know, no sliding is built-in.

Have a look at the first person controller in the standard assets. You can do the sliding yourself…

This is a problem I had earlier too…my solution was to remove slopes entirely!

First off, what are you using for your “slope”? If it’s just a box that’s been rotated to an incline, the character controller’s built in slope blocker doesn’t seem to work. If it’s a polygon on a mesh with a mesh collider, the built in slope incline seems to work.

This will stop your character from moving up inclines greater than the value on the character controller. Unfortunately, this is kind of useless on it’s own because you can just “bunny hop” up a slope by jumping. Even though you can move up the slope, if you jump and move forwards you’ll still ascend it.

I’m guessing what you want is this: if the slope is too big that the character is running up, he will slide down to the bottom.

Eric5h5 has a script over at UnityWiki, the FPSWalkerEnhanced that includes more features than the regular FPSWalker, including sliding.

There is no easy way to make the character controller slide down slopes, everything has to be scripted manually. This is because when the controller hits ANY surface when it’s being pulling downwards it is instantly stopped, no matter what the incline of the surface is. Rigidbodies, on the other hand, will slide down the surface at a speed depending on the incline.

Hope this helped bud![/url]

Interesting, so the FPSWalkerEnhanced uses the character controller and raycasts to find slopes? And doesn’t require a rigided body, for a platformer this is probably a good thing but i don’t 100% know.

Since my game is in 3rd Person would there be much i would have to change as the script is for 1st person?

Thanks everyone for your help!

No. The script only controls the player itself, not the camera itself, so it wouldn’t be too tough to change it to a 3rd person perspective.

I’m having issues getting the camera script SmoothFollowCamera to work with the FPSWalker.

Does anyone have a walk around?

Major problem is that it expects a 3rd person controller and i don’t know how to get around it.

Not sure I quite understand what your problem is…be a bit more specific. You should be able to add the SmoothFollow script to a camera, make the character the target and give the character the FPSWalkerEnhanced script…there shouldn’t be an error or anything.