SetSize() for StaticImage

I need a StaticImage as a platform and I need to SetSize it :

  • to make new collision box smaller than the original sprite
  • to “center it on the gameobject”
    What is the best way, please ?

I used this SetSize() :

Example :

Seems best to position the body manually and then use body.setSize(…).

Perfect answer ! Thank you very much. And I saw you’ve alredy opened an issue.
Sorry to not have find your last posts in the forum and issues…
I will try to do better :star_struck:

1 Like

So now I think you can get consistent results this way:

staticBody.setSize(w, h, 0, 0).setOffset(x, y)


Love this solution. This will help me as well with some collision modification I’ll be making.

StaticBody#setSize arguments have changed in v3.18.0.

1 Like

Thanks for coming back to this and updating it, Samme