How do you make an actor follow another actor where ever you go?

reginald.bernardinreginald.bernardin Member Posts: 346
edited January 2012 in Working with GS (Mac)
how do you constrain that actor to follow another?

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    You said the keyword. "Constrain"

    you would need to make some attributes to track the lead actor and then using the expression editor make your followers position be less than you leads position.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Head over to the unofficial GS guide and there is a link to a video about what you want to do. It's under actors in the index. http://gleesongroupmedia.com/gsguide/gsguide.html
  • reginald.bernardinreginald.bernardin Member Posts: 346
    @tenrdrmer less than the leader u mean having a negative value on the follower
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited January 2012
    yeah like constrain self position x to playerx-10

    or whatver you want.


  • reginald.bernardinreginald.bernardin Member Posts: 346
    Oh so like self x to positionx. The same with y right?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    You would just want to offest it

    So lets say
    If self.motion Linear velocity.X is Greater than 0
    Constrain self.position.x to game.leader.x-50

    Theres lots of different ways to accomplish what you want. This a simple way but depending on what you are doing you will need to adapt it.

    Another option would be Tracking the leader Speed and distance from the follower

    you would do some thing like this in the follower

    If game.distancefromLeader is > 50
    -Constrain self.linearverlocity.x to game.leadervelocityX
    -Constrain self.linearverlocity.y to game.leadervelocityY

    Lots of ways to do the same thing. You will just have to decide whats best for you. Definitly watch the videos too. Theres prob another way to do it in those.
  • reginald.bernardinreginald.bernardin Member Posts: 346
    Thanks in a try it
  • reginald.bernardinreginald.bernardin Member Posts: 346
    well for example a person moving with a bat. I want the bat to be in his hand and follow with him where ever he goes.
Sign In or Register to comment.