- Home /
Why does animation affect rotation?
I have a model, that is move in game by this script:
void Update ()
{
if (Walk == true&&transform.position!=Target.position)
{
float step = Speed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position, Target.position, step);
transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation (Target.position - transform.position), RotationSpeed * Time.deltaTime);
At the same time I try to play an animation, that I imported from 3dmax (fbx).
The problem is, when I use the script without the animation, the model rotates in the direction I need, facing towards the point of movement. But when I use the animation (basic walking animation), the model faces the opposite direction when moving. I have no idea why can this be happening, so I have to ask for help) Thanks in advance!
Answer by exvalid · Oct 21, 2017 at 05:37 PM
The animations you have used are offset in the wrong driection, in the right hand side if u doulble click the animation a few times it will have a box in right u can click a star thing in bottom right and pick a modle ie your avatar, then play the animation with the little play icon above , if it goes wrong then its the animation not aligned to Unity.
or aligned to the way you are innitaly facing when starting your scene
Your answer
Follow this Question
Related Questions
Scripting: make thing repeating 3 Answers
Animation problem with lag ! 1 Answer