Smooth camera movement? (like Limbo)

ApprowApprow Member Posts: 703
edited February 2015 in Working with GS (Mac)

I was wondering how to make the camera smoothly following the player. This video from Limbo shows what I mean

I tried it with the interpolate behavior, but I was unable to replicate this exact camera movement. The idea is that when the player starts walking the camera speed ramps up to the players position, and when the player stops the camera speed ramps down, but very subtle. If someone can help me out with this would be truly helpful!

Thanks

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited February 2015

    @Approw, to achieve this effect, put the Control Camera behaviour into a separate invisible actor, lets call it "CamActor".

    The CamActor is then constrained to the player actor with a dampening effect:

    Constrain Attribute self.motion.Linear Velocity.X to 5*(game.PlayerX - self.Position.X)
    
    Constrain Attribute self.motion.Linear Velocity.Y to 5*(game.PlayerY - self.Position.Y)
    

    The 5 is the dampening value, play around with this value until it feels right for you.

  • ApprowApprow Member Posts: 703

    @Hopscotch Thank you so much!! this was exactly what I was looking for!

    However, instead of using the control camera, I used,

    Constrain Attribute scene.Camera.Origin.Y to self.Position.Y-350

    The game is a top scroller and its just using the Y axis. if I used the control camera behavior, the player was always above the middle of the screen.

    Thanks again, you saved me a big headache:)!!

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Good stuff @Approw, glad it helped.

  • ApprowApprow Member Posts: 703

    aaaahhhhh @Hopscotch you made my game so much more awesome!!! no more static or glitchy camera movement. I will have a drink on you tonight;)

Sign In or Register to comment.