I have been studying the old locomotion system tutorial recently and noticed that it should be quite simple to adapt it to work with vertical surfaces. Has anyone tried implementing this for a climbing system?
Here is how I would envision it working:
Setup your biped to work with the locomotion system and include the Physics Character Motor
Create a trigger near the required climbable vertical surface
When the character enters the trigger set the Centric Gravity of the Physics Character Motor on (have it disabled by default) allowing the character to walk across surfaces perpendicular to the ground
Change the animation from walking to climbing
At the top of the surface place another trigger which when entered sets the Centric Gravity back to off, allowing the character to properly interact with ground surfaces again
I’ve experimented with this in the Planet Walk example in the locomotion tutorial. Below is a screengrab without any animation changes. Has anyone else experimented with this, and if so how have the results been? Or am I wasting my time trying to get a setup like this working?
Note: I am not asking detailed advice on exactly how one would go about implementing this. Rather just basic advice and more importantly if it is actually possible, so I know whether I am heading in the right direction with my climbing system implementation.
Thank you, looking forward to a reply.
It’s probably possible, but the solution sounds a bit messy. The Locomotion System was not made with non-horizontal source animations in mind, so the crawling animations would have to be crawling along a flat horizontal plane, and only afterwards could the whole model be rotated to climb vertically. I think getting the transitions between walking and crawling to look right without artifacts is probably going to be challenging.
Have to say I'm surprised there aren't more people trying this or at least asking about it. I've actually tried implementing a climbing system that works with the locomotion system, but it didn't end up being worth the effort.
1) First of all, as Rune suggested, the transition between walking mode and climbing mode (and vice versa) caused significant artifacts, limb twisting etc which proved a nightmare to try to control. One solution for this would be to have a completely separate control system for the climbing, which when initialized would disable the relevant locomotion scripts and take over control. However this leads to the second problem.
2) The benefit here of the locomotion system is that it semi-procedurally looks for height changes and adjusts the characters legs to match. In order to get this benefit for vertical motion, one would need to have a ladder built from colliders in order for the locomotion system to step on and off off. Doing this for an entire level is far too time consuming, even if using a ladder prefab. To get a good effect, every wall ladder needs to be aligned perfectly and tested extensively. The results are very good, but in my opinion not worth the effort and time, considering the other options available. Using just one box collider instead, would mean the character simply floats up the wall while in idle since there is no change in surface. This obviously defeats the purpose of using the locomotion system in the first place.
3) You could also try rotating the character, so that in theory they are walking horizontally but up and down instead of forward and backward, if that makes sense. I tried this too, but had issues with handling gravity. You could disable gravity completely while climbing, and enable when jumping or walking again. That may work but of coarse, then there's still the issue of handling the transition artifacts.
In summary then, I would advise not to use the locomotion system for vertical movement. If you want to use the locomotion system and have climbing as well, one option would be to create a separate control system for climbing and switch between them as necessary.
Lastly I would just like to add that I by no means am proclaiming to be "all knowledgeable" of the locomotion system. I'm simply sharing my experience and offering some (hopefully) helpful advice to an interesting question. If you have any more questions, let me know.