- Home /
How to make a camera follow a Player, but not allow the Player to go back ?
I'm able to make the camera follow the player, as it progresses through the platformer level, but how can I stop the camera from following the player, when it is walking backwards ? So basically, once you have passed a certain checkpoint in the camera, and it went past the left bounds of the camera, you cant go back to it anymore. As an example, I can say something like "Contra" comes to mind. Thanks.
Answer by kacyesp · Aug 29, 2014 at 06:21 PM
Why not add an if statement to your camera script, and only when that if statement is satisfied, you'll move the camera?
How can I check if the X vector is moving to the left, so that the 'movingLeft' boolean gets true, and restricts the camera to follow??
if ( nameOfVector.x < 0 ) movingLeft = true;
Is that what you're looking for?
Or you could do something like:
yourCamera.transform.position.x = $$anonymous$$athf.$$anonymous$$ax(checkpointXposition, yourCamera.transform.position.x);
@kacyesp , yep, that worked for me. Thanks for chi$$anonymous$$g in.
Your answer
