Found a solution, just hadn't set the animation configuration right
Rotate character
Hi, I have a code to make my character attack reproducing an animation I've created whenever I press the "V" key, the point is, the attack makes the character rotate, like the way the following image does
The point is, i works, it does the animation but not the rotation, the character keeps looking ahead during all the attack, how can I make it rotate? here's the script:
using UnityEngine; using System.Collections;
public class AttackMiddle : MonoBehaviour { Animator anim; bool m_Attack; int attackHash = Animator.StringToHash("AttackMiddle"); private object bl1;
void Start()
{
anim = GetComponent<Animator>();
}
void Update()
{
attack();
}
void attack()
{
if (Input.GetKey(KeyCode.V))
anim.SetTrigger("attackmiddle");
}
}
Follow this Question
Related Questions
tagged objects problem 0 Answers
How can i run a script with a single key press? 1 Answer
Searching a function to get the rotation of one Vector3 in relation to another 1 Answer
Timer wont work 0 Answers
Make enemy patrol without Nav Points? 0 Answers