Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Problem with "attack" animation

$
0
0
Hi, This is a newbie who has just started learning unity. So please bear with me on this question. I am basically trying to develop a 3d person game. I loaded the Spartan King 3D model, attached the character controller component and third person controller script (included in the default assets)for the Spartan king. This does the basic movements well.. he walks .. runs.. The PROBLEM : I wanted to add a extra animation to it. When the player clicks left mouse button, the attack animation has to be played. SO i went in to the update code (in third person controller) and added the following to the previous set of function calls : if(Input.GetMouseButtonUp(0)) { animation.Play("attack"); } Now my animation looks glitchy, Like when i click the button.. for that fraction of a second it starts to animate attack.. but after its clicked it goes back to the idle position. I think that in some other part of the code it sets a default animation like idle to be played when there is no input form the user.Maybe that is why it goes back to idle one the input click is over. Please correct me if i am wrong. I wanted it to complete the animation , then get back to idle. I would be very grateful if someone could help me on this. Thank You.

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>