Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED] Rotation problem  (Read 1463 times)

0 Members and 1 Guest are viewing this topic.

wcale

  • Newbie
  • *
  • Posts: 7
    • View Profile
[SOLVED] Rotation problem
« 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)
« Last Edit: February 12, 2013, 01:41:03 am by wcale »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Rotation problem
« Reply #1 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).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

wcale

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Rotation problem
« Reply #2 on: February 12, 2013, 01:40:39 am »
THANKS !!!!!!!!

It's working :D So simple...