Constrain camera between two actors?

FjantIncFjantInc Member Posts: 115
edited November -1 in Working with GS (Mac)
I'm playing around with a simple top-down racing game and would like to have the camera's position be based on the avarage of the two racing cars' position, but I can't get anything to work. I have an actor that I would like to place between these cars (and let it be the camera control) but I don't know how to do the math to place the actor between them.

Anyone?

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    The basic math would be:

    actor3.x = (actor1.x + actor2.x)/2
    actor3.y = (actor1.y + actor2.y)/2

    Hope this helps.
  • FjantIncFjantInc Member Posts: 115
    Awesome, it worked! Thanks!
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    You are welcome. I'm glad it worked!
Sign In or Register to comment.