No worries! I appreciate the help!
I really appreciate your time. I know how valuable it is.
I was looking through the callback information and unfortunately I'm confused about how to implement it after looking through the documentation and spineboy example project. I'm also a bit worried that by the time I understand and implement this animation callback system I'm also going to be having the same problem I am now. I say this because the current script I'm using is able to use the firing animation I made on on track 1 (all base animations like running, jumping, standing, and falling are track 0) when the X button is pressed, regardless of animations on track 0, it just never seems to update the IK strength like it's supposed to for the player's firing arm (I can see my arms twitching to fire, they just aren't point toward the IK target). Anything on Track 0 appears to be overriding the IK strength on track 1. I'll paste my full current code to see whether something is sticking out as an issue below.
If there's really nothing visibly wrong here and nothing else to try then I want to sincerely apologize in advance for the amount of posting I'm about to do to figure this callback stuff out 😃...
public class PlayerAnimScript : MonoBehaviour
{
Spine.TrackEntry setAnim;
SkeletonAnimation anim;
Spine.AnimationState animState;
Spine.Skeleton skel;
public Renderer rend;
public Dynamic_Player_Script player;
public string curAnimation;
public string debugShoot;
// Start is called before the first frame update
void Awake()
{
anim = GetComponent<SkeletonAnimation>();
rend = GetComponent<Renderer>();
skel = anim.Skeleton;
animState = anim.AnimationState;
debugShoot = player.xButton;
}
// Update is called once per frame
void Update()
{
checkifMoving();
checkifRight();
checkifFiring();
if(player.isInPlay)
rend.enabled = true;
else rend.enabled = false;
}
//flip the animation depending on which direction the player is facing
void checkifRight(){
if(!player.isRight)
skel.ScaleX = -1;
else
skel.ScaleX = 1;
}
void checkifMoving(){
//set animation state
if(player.inputDirection != 0 && player.ground && curAnimation != "running"){
setAnim = anim.AnimationState.SetAnimation( 0, "running", true);
setAnim.MixDuration = 0f;
curAnimation = "running";}
if(player.inputDirection == 0 && player.ground && curAnimation != "standing" ){
setAnim = anim.AnimationState.SetAnimation(0, "standing", true);
setAnim.MixDuration = 0f;
curAnimation = "standing";}
if(player.verticalVelocity > 0 && !player.ground && curAnimation != "floor_jump"){
setAnim = anim.AnimationState.SetAnimation(0, "floor_jump", false);
setAnim.MixDuration = 0f;
curAnimation = "floor_jump";
}
if(player.verticalVelocity < -1 && !player.ground && curAnimation != "falling"){
setAnim = anim.AnimationState.SetAnimation(0, "falling", false);
curAnimation = "falling";
}
//set animation speed
if(curAnimation == "running"){
setAnim.TimeScale = Mathf.Clamp(Mathf.Abs(player.Horizontal),0.5f,1);
if(Input.GetButtonDown(player.rightBump) && player.playerGrounded()) {
setAnim = anim.AnimationState.SetAnimation(0, "dash", false);
setAnim.MixDuration = 0f;
}
}
}
void checkifFiring(){
if(Input.GetButton(player.xButton)){
setAnim = anim.AnimationState.SetAnimation(1, "shoot", false);
setAnim.MixDuration = 0f;
anim.state.AddEmptyAnimation(1, 0.5f, 0.1f);
setAnim = anim.AnimationState.SetAnimation(2, "aim", true);
setAnim.MixDuration = 0f;
anim.state.AddEmptyAnimation(2, 0.5f, 0.1f);
}
}
}
I got it!
Sorry for the double post. The issue was that I was mistaken about how to set the IK in the Spine project, itself. I thought the IK had to be set to the intended weight at the start of each animation, when I just needed to set it at the start of animations that actually use the IK. Everything seems to be working correctly now. Thanks again for the help!