How can i constrain the rotation of a switch?

TheFloatingSofaTheFloatingSofa Member Posts: 21
edited June 2012 in Working with GS (Mac)
i have the rotation constrained to touch x so when i slide my finger it rotates. i just want it limited to rotate between 0 and 180.

Answers

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    when touch is pressed

    constrain self rotation to max(0,min(180,vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y )))
  • TheFloatingSofaTheFloatingSofa Member Posts: 21
    It still doesn't work and i did exactly what u said
  • TheFloatingSofaTheFloatingSofa Member Posts: 21
    it doesn't even move
  • TheFloatingSofaTheFloatingSofa Member Posts: 21
    ok i got it now i don't know what was wrong but it works thanks
  • MegaemmanMegaemman Member, PRO Posts: 72
    I kinda want to do the same thing i wanted to create a slider that i want to control a the rotation of a platform
  • SocksSocks London, UK.Member Posts: 12,822
    I kinda want to do the same thing i wanted to create a slider that i want to control a the rotation of a platform
    Quick demo:

    http://www.mediafire.com/?2pcp78o59qzw1r5
  • youngdeveloperyoungdeveloper Member Posts: 8
    edited April 2013
    @tshirtbooth @JohnPapiomitis
    The half rotation works fine, but this is only affected when touch is below the actor. How can I achieve so actor's rotation always follow my finger, but has got it's min and max, let's say 30 and 150'?

    I would much appreciate any help here as I find myself stuck.
Sign In or Register to comment.