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

Author Topic: Changing center of rotation  (Read 2915 times)

0 Members and 1 Guest are viewing this topic.

Mr. House

  • Newbie
  • *
  • Posts: 4
    • AOL Instant Messenger - 7754+Meridian+St
    • View Profile
Changing center of rotation
« on: October 12, 2011, 03:16:21 am »
Hello,

I have a sprite that I would like to rotate around a point that is not the origin nor a point of the shape.

Here is a screenshot of my situation:

http://i.minus.com/ibt8ncX55ODhrh.png

I want that yellow sprite to rotate around the centerpoint of that circle like the Moon around the earth, so that the sprite follows the shape of the sectors.

I've tried messing around with the Sprite.SetCenter() methods but I'm not sure if what I'm doing is right.

Anyone have any wisdom on this matter? I'll post my code if needed. I'm using 1.6.

sbroadfoot90

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Changing center of rotation
« Reply #1 on: October 12, 2011, 07:54:07 am »
yeah SetCenter() does what you need, you're just going to have to do some maths to work out exactly what parameters to pass to make it work how you want :)

Mr. House

  • Newbie
  • *
  • Posts: 4
    • AOL Instant Messenger - 7754+Meridian+St
    • View Profile
Changing center of rotation
« Reply #2 on: October 12, 2011, 10:16:55 pm »
It doesn't seem to though. I used SetCenter(50,50) but it doesn't place it at point (50,50). I don't get it :/

Would you like me to post my code and see if you can offer me a solution?

sbroadfoot90

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Changing center of rotation
« Reply #3 on: October 12, 2011, 11:37:50 pm »
yeah that would be helpful. also upload the image you are rotating as well as its dimensions

Mr. House

  • Newbie
  • *
  • Posts: 4
    • AOL Instant Messenger - 7754+Meridian+St
    • View Profile
Changing center of rotation
« Reply #4 on: October 12, 2011, 11:44:07 pm »
Nevermind, I figured it out.

Gazonga

  • Newbie
  • *
  • Posts: 3
    • View Profile
Changing center of rotation
« Reply #5 on: January 28, 2012, 09:59:23 pm »
You wouldn't mind posting how you solved it?
I'm having similar problems ;/
ThinkPad t41, OS: Ubuntu 10.04

TechRogue

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Changing center of rotation
« Reply #6 on: January 30, 2012, 03:38:04 am »
What's the problem you're having? We might be able to help.

 

anything