asked Sep 23 '10 at 05:00 PM
To run up walls isn't bad, but gets trickier depending upon how you implement your running in the first place.
The simple solution is to raycast in the direction you are running and align your animations to the surface if it is within a certain distance (the distance you'll be moving in the current frame for example). If you add inertia or anything like that, you'd want to consider that too.
I recommend looking at the locomotion system for more on aligning animations to a surface.
Raycasting is simple.
Also, since you know that the normal you're aligned to is not the world up, you can do smart things like balancing the weight against the surface (wall running la Prince of Persia).
You should also take into account collisions and the character's lean if they lean into their running animation.
answered Sep 23 '10 at 09:08 PM
I'm always late in answering questions on Unityanswers, but...
The first function takes in the "vect" from "GetMoveDir," all you have to do is insert the "normal" from a raycast.
Should work 100% of the time if I copied the right bit.
Also, I always use Translate(vector, Space.World) or more recently Rigidbody.MovePosition, Translating an object with respect to itself gets annoying during jumps, as you have to recalculate every--single--frame.
This will work on walls and ceilings. It'll work as you expect on walls and floors, but if I'm not mistaken, ceiling controls will be inverted.
I wrote all this myself, so I should know the fine details a little better, but w/e.
Another "easy" way to do this, using Unity's charactercontroller is by using "Slope Limit". It's a build-in function which allows you to change how high a slope your character can walk, run or climb. - I know this isn't exacly like PoP but it's a start, right? :)
Hope this will help :)
answered May 03 '12 at 07:15 AM