- Home /
Question by
artificial256 · Apr 02, 2018 at 09:48 PM ·
idleidle animations
Idle Direction
I have looked up other forums although i couldn't apply it to my script. It might be a reference issue on my part but for some reason i cant get the idle to stay in the position it was last called. Anyone have a better idea of what i can use? here is my script: if (controller.isGrounded) { currentBaseState = anim.GetCurrentAnimatorStateInfo(0);
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if (currentBaseState.fullPathHash == locaState)
{
if (Input.GetButton("Jump"))
{
anim.SetBool("Jump", true);
moveDirection.y = jumpSpeed;
}
}
else if (currentBaseState.fullPathHash == jumpState)
{
anim.SetBool("Jump", false);
}
}
moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
//This was the code i was trying to use
transform.rotation = Quaternion.Euler(0,moveDirection,0);
}
Comment
Your answer
Follow this Question
Related Questions
What's a good way to do multiple Idle animations? 2 Answers
How can I move between two idle animations for an NPC on a timer? 0 Answers
Why does my animation not play? idle overrules animation? 2 Answers
Animated character making mesh move when idle-animation is playing 1 Answer
Idle Animations, Player Walking 0 Answers