Constrain an actor to another actors angle without rotation??

ironDanironDan Member Posts: 148
edited November -1 in Working with GS (Mac)
I have a main actor who faces 0 and I'm trying to constrain his hands to his sides. He is viewed from above so his left hand would need to be locked to his 90 and right hand at 270. The main actor has full 360 degree motion and when he moves the hands stay in place and he rotates. Example: His hands are at 90 and 270 as he faces 0, but when he moves 90 his hands are still at 90 & 270 (basically a hand on his head and one on his foot) What I need is for them to stay at his sides when he goes 0-360. Any help solving this is much appreciated!!

Dan

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    Sounds like you need cos and sin on the hands, if you look at the video from our platform template you will see a brown circle with 2 red platforms...these are using cos and sin and will rotate with the circle.

    Its a little hard to explain but it is possible to set up actors around another actor and have them stay in sync.



    Darren.

    image
  • ironDanironDan Member Posts: 148
    Thanks Darren!

    Its a good thing I own that AWESOME template (and almost all of DBA's other ones ; )
    I took a look inside as I do with all of them and found the answer to my problem. Thanks for leading me in the right direction.

    Dan
  • ironDanironDan Member Posts: 148
    One problem I have is that the hands now stay fixed at the actors 0 and 180 regardless of the direction he travels, instead of 90 and 270 and once again I am scratching my head trying to fix?? :-/

    Any suggestions?

    Dan
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    can't you just rotate your actor image in photoshop to compensate and then in the circle actor in GS just change the initial rotation so it all looks right.
  • ironDanironDan Member Posts: 148
    Hi scitunes,

    Im not sure it's an image direction issue that has me stuck. The hands are constrained to the body at the 0 and 180 positions. So when my actor is moving left or right his hands are in front and behind him. When he moves up or down his hands are above and below him. Below is the code Im using.

    Actor:

    game.playerAngle to self.rotation (game.playerAngle is global Angle)
    game.playerx to self.positionx
    game.playery to self.positiony

    Left Hand:

    self.rotation to game.playerAngle
    self.positionx to game.playerx +cos( game.PunchysAngle %360)*64
    self.positiony to game.playery +sin( game.PunchysAngle %360)*64

    Right Hand:

    self.rotation to game.playerAngle
    self.positionx to game.playerx -cos( game.PunchysAngle %360)*64
    self.positiony to game.playery -sin( game.PunchysAngle %360)*64

    I really need my players hands to stay at his sides regardless of what angle he is moving in.

    Any Ideas?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Make these modifications:

    Left Hand:

    self.rotation to game.playerAngle
    self.positionx to game.playerx +cos( (game.PunchysAngle+90) %360)*64
    self.positiony to game.playery +sin( (game.PunchysAngle+90) %360)*64

    Right Hand:

    self.rotation to game.playerAngle
    self.positionx to game.playerx +cos(( game.PunchysAngle+270) %360)*64
    self.positiony to game.playery +sin(( game.PunchysAngle+270) %360)*64
Sign In or Register to comment.