How to rotate object that maintain their distance.

DhondonDhondon Member Posts: 717
edited November -1 in Working with GS (Mac)
I've been struggling with angles and offsets tonight, and can't get this to work:
How do you have an control-object that 2 (or more) object match the position(with offsets) and angle to the control object?

image
(The object with circle is the control-object and the dotted lines illustrates constraints with position and angle info)

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    youll have to use the sin and cos expressions to maintain the position and rotation equal to the center
  • DhondonDhondon Member Posts: 717
    Thanks John, that what I've been playing around with.
    This is what I got so far:

    self.Position.X game.box-X + 96*sin(game.boxRot)
    self.Position.Y game.box-y + 16*cos(game.boxRot)
    self.Rotation game.BoxRot +90

    But I can't position the box in the Y direction, the offset doesn't work.
    See any problems with the code? (I know my match skills suck:) )
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    im pretty sure the x should be cos and the y should be sin

    you also might need to put a offset inside the (gmae.boxrot)
  • DhondonDhondon Member Posts: 717
    JohnPapiomitis said:
    im pretty sure the x should be cos and the y should be sin

    you also might need to put a offset inside the (gmae.boxrot)

    Changed to cos(X) sin(Y), but the pieces doesn't hold their position properly.
    What kid of offset would I need in the rotation?
  • micksolomicksolo Member Posts: 264
    I struggled with this issue for a long time and in the end I couldn't get it to work. I was trying to have seperate collision for arms on a human actor who would rotate but the arms would always seperate.

    The whole thread is here, maybe you can get some ideas and if you find the answer please let us know!

    http://gamesalad.com/forums/topic.php?id=20367
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    sent u a email dhondon :)
Sign In or Register to comment.