Search Unity

Using an animation's baked Transform Position without actually baking in the position

Discussion in 'Animation' started by ArchSinccubus, Aug 10, 2022.

  1. ArchSinccubus


    Jun 2, 2017
    So... This is a bit of a pickle I'm in, and I'll try my best to explain my situation

    I have a game I'm working on who's character controller is used on the one in Unity's Standard Assets (Third person controller). I've hacked it to bits, added a ton of code, and now the character can climb, run, hike up walls, lots of new stuff.

    The issue I have now is... With the ledges the character can grab, as well as the animation of them climbing upwards.

    What I initially did was take an animation from Mixamo of a person climbing up a ledge, and used it for my game. And, since the controller's motions are _already_ based on the Animator's movements, I baked the y position of the animation into my animation, so that when the character climbs, I don't have to actually move it manually. It'd use the animation's y position, and then transition back to grounded movement.

    In addition, when doing the ledge grab, I wanted the character to stick to the edge of the wall. So, to do that, I put the ledge animations on a y offset, allowing me to have them move across the wall without having to temper with the collision in any way. And so far that worked.

    Until... I had to contest with wall climbing.

    Because of the way I have it set up, when the character finishes climbing a wall all the way, they will enter ledge animations. That is because they are now hanging from the top of the wall. However... Since the wall animations don't have a y offset, that creates a weird transition in which the character suddenly rises into the air and then goes down. So far, I managed to fix that, and put the y offsets back to 0. Now however, I have to do the same with the climbing animation, which is the only one that has a distinct change in it's y position baked into it. If I don't leave it baked, the character just does the animation in place and then falls. If I do... the second the animation finishes, the transition to grounded animation will pull it back down _anyway_, because of the lack of offset.

    So, in a way, the best solution I can see is to use an animation's baked position movements... Without actually baking them in. And I have no idea how to do that.

    Any suggestions?