How to orbit around one actor while always point to another actor (level end actor)

poopdecksweeperpoopdecksweeper Member Posts: 180
edited February 2012 in Working with GS (Mac)
Hi all,

I am trying to have a pointer actor orbit around my main character actor, and always point at the level end. The level end has it's own X and Y attributes that I have constrained to, as well as the main character, but I cannot figure out how to constrain the arrow to the main character while also constraining the arrow's angle to the level end actor.

Best Answer

  • poopdecksweeperpoopdecksweeper Posts: 180
    Accepted Answer
    i got it! thanks for the help man. Here is the formula I had to use:

    constrain: self.position X to -35*cos(vectorToAngle( self.Position.X - game.FireX , self.Position.Y - game.FireY )%360)+ game.HeroX
    constrain: self.position Y to -35*sin(vectorToAngle( self.Position.X - game.FireX , self.Position.Y - game.FireY )%360)+ game.HeroY
    constrain: self.rotation to vectorToAngle( self.Position.X - game.FireX , self.Position.Y - game.FireY )-270


    I realized that the actor is constrained to numerous different attributes which change the actor's rotation. Therefore, I had to deduct the rotation difference from the main character actor.

    Thanks for the help

Answers

  • poopdecksweeperpoopdecksweeper Member Posts: 180
    I cant figure out what my normal orbit rules are either. I have tried so many, but they all seem to make the arrow actor follow odd paths.

    I even tried using your orbit video as a template, but I don't know how to do the rules without your time rules as a constant.
  • poopdecksweeperpoopdecksweeper Member Posts: 180
    Thats extremely close TSB, but I don't want the earth actor constantly orbiting in circles around the sun actor like that. I dont need the (time) part of the cos equation that is making it rotate around a given point over x amount of time. I need the earth actor to constantly point towards the end of the level, but being constrained to the sun.

    thanks so far
Sign In or Register to comment.