I'm creating a 2D game that requires a player to slide under certain obstacles, I've got the animation to play at the correct time what I'm struggling with is actually making sure the models box collider can duck under the destroying collider, I can get it to move down but it seems no matter what I do it won't return to it's original position, any help appreciated, I've tried quite a few things so I'm open to changing how the collider moves too.
void Slide()
{
BoxCollider2D bc2d = GetComponent();
bc2d.center += new Vector2(0, -1);
anim.Play("Sliding");
}
↧