Quantcast
Channel: Questions in topic: "stopping-animation"
Viewing all articles
Browse latest Browse all 60

how to stop an animation at a specific frame on animator?

$
0
0
Hi, I've seen all the forum topics on this subject but in my case the situation is a little bit different and I don't know what to do :( If someone helps me, I would be very grateful :) I have an animator that when it is in the state of attack, it performs an animation (the attack animation). What I want is when the attack button (space) is pressed (only once), the attack animation normally plays. "But", when I press the space button (without dropping it), the animation stops at a certain specific Frame and, When I release the space button, the animation continues from the point where it stopped. My code is almost identical to this (has more things), and i want something like that/this: ____________________________________________________________________________________________ public class PlayerControls : MonoBehaviour { private Animator anim; void Awake() { anim = GetComponent(); } void FixedUpdate() { Animation(); } void Animation() { if ( Input.GetKeyDown(KeyCode.Space) ) { anim.SetBool("Attack", true); Attack(); } else if ( Input.GetKey(KeyCode.Space) ) { anim.SetBool("Attack", true); anim.Stop( *at frame 35 of 68* ); if (Input.GetKeyUp(KeyCode.Space)) { anim.Play(); // play from the frame 35 (when it stopped) } } }

Viewing all articles
Browse latest Browse all 60

Trending Articles



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