For this project I wanted to learn how to create interesting locomotion on foot and parkour seemed like a great way to do this. The problem was figuring out how to make parkour look good in a varied environment. Objects have various heights and depths so a variety of animations were needed.
After I found the animations I wanted to use, I had to figure out how to trigger them based on the obstacle in front of the player. To do this, I need to use a line trace. A line trace performs a collision trace along a line and returns the first object that is hit. When the player initializes a jump I fire a single line trace in front of the player. If it doesn’t hit anything, the player performs a normal jump. If it does hit something, more information about the object is needed, so I fire 2 more line traces from the point of collision. The first line goes straight up to find the height of the object. If the height is too high to be reached the character performs a normal jump. If it isn’t I need to find the depth of the to determine the type of jump to do. A third line trace is fired forward from the point of collision to find the depth of the obstacle. If it’s wide enough to stand on, the character will climb onto the object. If it’s the character will climb or vault over the obstacle.
This was a great way to learn a lot about collision and line traces. The system worked well enough, but it required a lot of fine tuning to get it to look good. If I ever revisit this, I think I’ll try giving all obstacles height and depth attributes so less tracing will need to be done to find that information.


Leave a comment