unity-game-enginespritecalculationsprite-sheetcollider

Calculate BoxCollider2D based on the actual player sprite


first of all my initial situation: I am working on a 2D project. The player consists of a spritesheet and has small animations. The animations are not always exactly as big as the idle form of the player. It scales a little bit in width and height.

Now I am wondering if it is possible to calculate the BoxCollider2D based on the actual size of each sprite.

Can anyone here give me some guidance on how to solve this situation?

Best regards :)


Solution

  • Thanks for your Answer @derHugo and @Chipinators, i used the suggestion from derHugo and it worked right away. The BoxCollider2D is also calculated completely independently depending on the animation. With one/two animations I only had to touch up a little.

    Thanks again for your answers. ;)