Polygon rotation and Bitmap Rotation does not match

Hello everyone,

i finally found a way to do a nice collision detection using polygons.
The problem i have now is that when i rotate the polygon, that i draw on screen using SDL2_gfx library, the polygon is correct, but the bitmap that i rotate via RenderCopyEx function doesn’t match at all.

shipAngle = vecShapes[0].angle;
shipPosX = vecShapes[0].pos.x;
shipPosY = vecShapes[0].pos.y;

//Move the ship
ship.move(shipPosX, shipPosY, shipAngle);

then i call the render function
ship.render();

if i print the angle of vecShape and the angle of the ship the angle is the same, but clearly the shape of the ship rendered with RenderCopyEx is wrong.

any hint?

Thank you in advance

Are you able make a screen shot showing how the rotated polygon and ship are different?

Also, are the rotation points the same in your physics engine and RenderCopyEx?

Here’s a screen capture.
Rotation points are the same.

Is one thing using degrees and the other using radians?

It looks like the angle that’s passed to SDL_RenderCopyEx() is in radians and not in degrees.

I tried to use radians for both, but no change. Same result.

is in degrees.

Tried angle and degrees. Same results.

Solved! It was really a radiant problem.

I wrongly has an assumption that the original value was in Angle and had to convert to rad. Quite the contrary.
Original values are in radiants and now i convert to degree and it works like a charm.

Thank you all for the comments

1 Like