Challenge 1: 2D Smooth Camera

Here it is the result of Wednesday’s tutorial. I was able to get a smooth camera, and have a parallaxing background script that can be used for any size background. I did however, ran into smooth movement issues with the player since moving the rigidbody made the animation jaggy. Anyway I was able to fix it in the end and I am done with this experiment for now. I tried to add comments to the stuff I thought people might have issues understanding so feel free to download it. herehttps://github.com/TechGenus/2DSmoothCamera

Comment on any new discoveries u might have run into from this tutorial and lets do this again next Wednesday.

Also, for the record, the background image that is in the game was labeled for reuse and borrowed from google images.
Here is link: https://www.google.com/search…:

Here’s a code snippet for smooth camera:


void translateCamHorizontallyTo(float x)
{
	Vector3 newPos = new Vector3(x, transform.position.y, transform.position.z);
	// Vector3.Lerp(position1, position2, speed of lerp);
	transform.position = Vector3.Lerp(transform.position, newPos, speed);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>