SFML community forums

Help => Graphics => Topic started by: wcale on February 12, 2013, 01:05:52 am

Title: [SOLVED] Rotation problem
Post by: wcale on February 12, 2013, 01:05:52 am
I have C# project with SFML 2.0

It is possible to rotate obiect at middle point (not at left upper corner)?

I try something like this:

double whell_angle;
whell_angle++;
ship_whell.Rotation = (float)whell_angle;//ship_whell is a sprite with texture size: 27x27 px

ship_whell.Position = new Vector2f((float)(ship_position_x_p + 10 + (Math.Sin(((whell_angle+60) * Math.PI) / 180.0f)) * 14), (float)(ship_position_y_p + 70 - (Math.Cos(((whell_angle+60) * Math.PI) / 180.0f)) * 14));

Everything i tried is rerrible (also SFML.Net.chm)
Title: Re: Rotation problem
Post by: eXpl0it3r on February 12, 2013, 01:19:36 am
Well I don't know anything about SFML's .NET version, but it should be the same as in native C++, you call setOirigin and set it to the middle (doc (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Transformable.php#aa93a835ffbf3bee2098dfbbc695a7f05)).
Title: Re: Rotation problem
Post by: wcale on February 12, 2013, 01:40:39 am
THANKS !!!!!!!!

It's working :D So simple...