Crossfade between a animation and a look at: How to?

Hello everyone,

as the title of the topic says, i’m attemping to write a script that rotate the neck of a character with a look at when triggered.

This is the situation i have now:

1- I have the animation of the full body and the same animation of the body without the neck animation curve

2-when triggered, the full animation crossfades to the animation without the neck and, at the same time, the look at comes into play

3- when the player is out of the trigger zone, the look at is switched off and there is the crossfade between the animation without the neck and the animation of the full body.

4- Here comes the issue: instead of having a good interpolation, i’m getting a non smooth transition between them

Has anyome already faced a similar situation? Basically, i’m tring to find a way to move dynamically the neck of an animated character when the player goes near him, so that they can be one in front of the other.

Thanks in advance

Take care

I think this may come down to an issue of your code that is rotating your neck. Are you doing anything to blend out how much you are rotating your neck? It would seem to me that you should need two animations, and that your code can rotate the neck after the animation is applied. And have some code to control how much to rotate by while blending it out. Does that make sense?

Not 100% sure how you are doing things. If you are trying to use two animations at the same time, then you need to use layers to run them both at the same time.

As stated, I’m not sure what you are doing. Is the trigger just suppose to run the looking animation? Is it running a function of a script that controls the look? I’m just not sure.

Thanks a lot for both the replies!

Let me explain a little bit more.
The crossfade between the full body animation and the without neck animation works well.
After this switch a script rotates the neck of the character in order to follow the player camera, with a suitable smooth.

This part works fine.

The problem comes out when the player exit the triggering zone; in that case the script rotates the neck of the player back exactly to the original position (let’s say the “relax position”) and the crossfade from animation without neck to the full body animation.

At that moment, when the full body animation starts I suppose, the neck has a twitch that rotates the neck by some degrees, always in the same position.

I hope this explaination can be useful to help me to solve this issue…