0
votes

I'm using libgdx to create my game and I use box2d as physics engine, I have a body with a polygon shape set as box .5x.5(1x1 meter) and I want to rotate it around it's center. I tried to do this:

shape.setAsBox(0.5f, 0.5f, new Vector2(0.25f, 0.25f), 0);

I'm not sure but I think that the Vector2 is used to set the origin of the shape, so the origin is half of 0.50x0.50 so it means it is in the center but it still doesn't work which means there something wrong with my code or my understanding on how to set the origin.

1

1 Answers

0
votes

Two things you should try:

  • Check if the 3rd parameter is actually the origin.
  • Try setting the origin to 0.5, 0.5 instead. Maybe it's relative to the size.