GMS 2 Rotating object from center point

Discussion in 'Programming' started by mastmartelli, Sep 12, 2019.

  1. mastmartelli

    mastmartelli Member

    Joined:
    Jan 17, 2019
    Posts:
    58
    I'm altering the object's image_angle, making it rotate in a full 360, but the problem is that it's not rotating from the center of the object, it looks like it's rotating from the bottom left corner. its hard to tell where it's rotating from, but the object is a 3x3 red square and I have the origin point set to middle center, so im not sure what the problem is
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,800
    First off, don't just put the origin in the center. Put the origin where you need the Sprite to rotate around. now, if your Sprite is entirely filled with a red square with no empty spaces around it and you center the origin, then it should rotate around the origin.

    Disclaimer: the Sprite rotates around a point, not a pixel, so it is going to wobble 1 pixel as it rotates. there's not much you can do about that so you will have to correct the positioning based on the angle.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice