- Home /
Returning a Box Collider to it's orginal position
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<BoxCollider2D>();
bc2d.center += new Vector2(0, -1);
anim.Play("Sliding");
}
Your answer
Follow this Question
Related Questions
How can I change sprites when player enters Collider?????? 2 Answers
Tilemap Collider 2D preventing objects from moving 2 Answers
Polygon Collider 2D doesn't have the "edit collider" button avaliable. 0 Answers
Camera rotation around player while following. 6 Answers
Enemy position transform 1 Answer