playMaker

Author Topic: Smooth Camera Follow  (Read 8164 times)

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Smooth Camera Follow
« on: December 10, 2011, 12:21:37 AM »
I'm creating a camera for a side scroller and at the moment I have simple setup which locks the camera to the Y and X position of the player.

I've been trying to create a camera that with the same behavior, but with smoothing (such as the smooth look at action) but I'm not finding anything that can do this in real-time. Actions such as animate vector3 or interpolate do not work because they can't be executed every frame, and will break the animation after it finishes the animation.

I want to plan for the possibility for the camera to average a position between 2 characters as well but that will be for later in development, I'd like to get this issue squashed ASAP.

Thanks for the help!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Smooth Camera Follow
« Reply #1 on: December 10, 2011, 11:57:40 PM »
You could use a dummy game object as the camera target, instead of the actual target game object. This dummy could have it's own FSM with states like TrackHero, TrackEnemy, AverageTargetPosition etc. The dummy can use iTween Move To or another action to move around smoothly, then you lock the camera to the dummy. This intermediate game object should give you more control over the camera, and you can render it when you're debugging the camera tracking.

MABManZ

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 125
    • MABManZ.com
Re: Smooth Camera Follow
« Reply #2 on: December 13, 2011, 07:25:16 PM »
Thanks a lot I think I've got something going now :)