GM:S 1.4 !Ragdoll rotation towards mouse

Discussion in 'Programming' started by santeri kalliomaki, Feb 14, 2018.

  1. santeri kalliomaki

    santeri kalliomaki Member

    Joined:
    Feb 11, 2018
    Posts:
    13
    Hi! I want my ragdolls head to point at mouse but actually the right side of the ragdoll points towards mouse.
    What can I do? :(
    I think this is happening because the sprites are not pointing up.....


    Code For Direction:

    direction = point_direction(phy_position_x,phy_position_y,mouse_x,mouse_y)
    phy_rotation = -direction;
     
  2. 2Dcube

    2Dcube Member

    Joined:
    Jun 23, 2016
    Posts:
    371
    So it's rotated 90 degrees too far? Just subtract 90:
    Code:
    direction = point_direction(phy_position_x,phy_position_y,mouse_x,mouse_y) - 90;
    phy_rotation = -direction;
     
    santeri kalliomaki likes this.
  3. santeri kalliomaki

    santeri kalliomaki Member

    Joined:
    Feb 11, 2018
    Posts:
    13
    I did not think it would be so easy. Thank you so much! :p
     

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