Not sure the best way to do this. I have a character with a complete archery animation. It knocks the arrow and releases when I press the key.
The knocking of the arrow part of the animation is frames 960-995. The release occurs at frame 996-1015. Pressing my archery key runs the animation from 960-1015.
I use 2 scripts for input. One is “PlayerInput.cs” the second is “AdvancedMovement.cs”
In PlayerInput.cs
if(Input.GetButtonDown(“Archery”)) //K key
SendMessage(“Archering”);
Then in AdvancedMovement.cs
public void Archering() {
_archer = true;
}
…sends to the state machine, if _archer = true it calls ArcherAttack();
public void ArcherAttack() {
if(archerAnimName == “”)
return;
animation.CrossFade(archerAnimName);
}
also in the Init() function it sets the animation to wrap once:
if(archerAnimName != “”) {
animation[archerAnimName].layer = 6;
animation[archerAnimName].wrapMode = WrapMode.Once;
}
So, that said, I tried to break the current animation “arch attack” into 3 parts: “arch knock”, “arch hold”, and “arch release” within Unity by creating a new animation and assigning the frames to each: “arch knock” = 960-995; “arch hold” = 995-996; “arch release” = 996-1015.
After applying it, and going back to my characters list of animations the new ones don’t show up. Likewise when I substituted the “arch knock” for my working “arch attack” it can’t find it.
So, I don’t have animation software outside of Unity. What is the best way to split my animation up using code within my state machine.
I need help with a couple things:
–While archery key is being held down: play animation frames 960-995 and hold animation frame 995 until the input key is released.
–When the input key is released, play the second half of the animation from 996-1015.
So I’m not exactly sure how to go about it. Can I specify it using code to play and hold certain frames, or do I split up each and have it play the “knocking” then loop a single frame where the character is pulling the bow back, then trigger the third animation when the key is released?
I have the same problem with my blocking and other areas (casting to load a spell and then to release it). It plays the complete animation, I want it to play once and hold the last frame while I’m holding the parry key.
Been reading through the docs and followed the animation examples to define new animations using the key frames but it doesn’t come through to the character…
Any help is greatly appreciated. If you know of a good example of casting or multi part animations/particle effects lemme know. Thanks!