unity3d - Using Parallaxing for a 2D game in unity Understanding the Z axis -
i'm using parallaxing 2d game in unity , basically, i'm moving position of backgrounds on x axis whenever camera moves (the camera moves right or left following character). i'm having trouble understanding line means parallaxscales[i] = backgrounds[i].position.z * -1; doesn't z position have depth? mean when position.z * -1 or position.z * 5. not affecting actual depth of backgrounds ive been using in game (since moving left , right). mean. why use z axis? using unityengine; using system.collections; public class parallaxing : monobehaviour { public transform [] backgrounds; private float [] parallaxscales; public float smoothing = 1f; private transform cam; private vector3 previouscampos; void awake () { cam = camera.main.transform; } void start () { previouscampos = cam.position; parallaxscales = new float[backgrounds.length]; (int = 0; < backgrounds.length; i++) { parallaxscales[i] = b...