Animation vs Position / Rotation

Hi there guys, i was watching some videos about game development, and than i saw something that is bugging me already. For example you have a model in scene controlable everything works just fine, but you need it to climb down a stair so the player is facing the top of the stair and he turns his back to the ledge to make his way down.

How do you guys think is the best solution to achieve this result?

I’m asking because with the character controller if the animation start to rotate to make the way down to the stair the character controller will not move or rotate, and when the animation finish at the stair waiting the user action input the character controller component is in another position/rotation. (i’ve done some test and it was not good)

Regards (merry christmas)

You would probably use a combination of animation and position/rotation. You can’t really use one or the other. If you make only the animation you will end up not going anywhere or if you make a script that assigns the transforms then your character will look like its floating. I don’t think the animation affects the transforms at all.

I don’t know if you understand, but see the video maybe it will explain better what i’m saying.

In this case i need the animation to rotate, otherwise how could i get the player to get his back close to the wall? The problem is when the animation rotates and stays at a diferent rotation from the characterController when i get back to the original position the mesh rotates because the original animation is again in a direrent rotation than the animation close to the wall. Then i thought why not use Lerp to rotate the transform while the animation play, but there’s the problem i also show in the video, if i rotate it the animation will get another rotation… :slight_smile: there’s anybody to know the solution??

I have solved this before makeing the exit animation to be the reverse of the enter close to wall animation…but it sucks

Any idea?

Bump…

I’ve done this few months ago by not rotating the character, just playing the cover animation and then rotating the character controller to be aligned with face normals of the mesh, using RayCast.
Something like:

transform.rotation = Quaternion.FromToRotation(Vector3.forward, myRayCastHit.normal)

For smooth transition you’d use Lerp.

It’s the same thing i’ve tought, but looks like i have to not rotate the character animation (this is bad in this case i think is going to loose the smooth animation i’ve done). Anyway thanks Bruno