I have a player with a hitbox child that changes its position frame by frame as an attack is being performed. It works fine when it’s only on one animation but when I apply it to the up down left and right animations it blends the four transforms of the hitbox together (Or at least I think that’s what it’s doing).
I Just learned about blend trees today and find them very useful but Is it not possible to use this kind of hitbox whist having the animations within a blend tree?
Thank you!
Okay so it turned out to be a coding issue, this was causing the problem.
x = Input.GetAxis("Horizontal") * player.moveSpeed * Time.deltaTime;
y = Input.GetAxis("Vertical") * player.moveSpeed * Time.deltaTime;
transform.Translate(x, y, 0);
if (x != 0 || y != 0)
{
anim.SetBool("Walking", true);
anim.SetFloat("XInput", x);
anim.SetFloat("YInput", y);
}
else
{
anim.SetBool("Walking", false);
}
This is what I had, and the reason it wasn’t working was because since the axis values weren’t raw the animation was getting inputs of like 0.06 on the x and y axis which means that the box collider WAS moving but it was an extremely small amount. It needed to be getting a straight -1 or 1 to move all the way so I changed everything to raw and made the floats of the animator also get raw inputs.
transform.Translate(Input.GetAxisRaw("Horizontal") * player.moveSpeed * Time.deltaTime, Input.GetAxisRaw("Vertical") * player.moveSpeed * Time.deltaTime, 0);
if (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0)
{
anim.SetBool("Walking", true);
anim.SetFloat("XInput", Input.GetAxisRaw("Horizontal"));
anim.SetFloat("YInput", Input.GetAxisRaw("Vertical"));
}