playMaker

Author Topic: Smooth camera follow w/options  (Read 2200 times)

Lobohotpants

  • Playmaker Newbie
  • *
  • Posts: 38
Smooth camera follow w/options
« on: July 11, 2014, 06:59:15 PM »
I'm making a horizontal scrolling shooter.  I need a camera that will follow the player smoothly and stop a few units away from the edges of the screen.  What I call the "dead zone".  When the player enters the "dead zone" the camera stops following in that direction and the player can continue a short distance to the edge of the screen.  These dead zones are independent on the x and y. 

For example, the player reaches the dead zone on the -X or left side of the screen.  The camera stops moving in the -X direction but can continue to move in Y.

I've been able to set this up and it works how I want.  The only problem I have is the camera isn't smooth when it's following the player.  I'm using a Vector3 Lerp on the Camera to chase the Player.  A Get Vector3 to isolate the X and Y positions.  Finally a Set Position using X and Y. 

All of this is in one FSM State running at Every Frame. 

How can I get a smooth follow without having to use the smooth follow action?

Lobohotpants

  • Playmaker Newbie
  • *
  • Posts: 38
Re: Smooth camera follow w/options
« Reply #1 on: July 12, 2014, 09:21:59 AM »
Update - I'm not sure what happened but it seems to be smooth now.  I'm wondering if it was frame rate dependent or what but it's working how I want it.