How do I move ground such as the video ?
I want to move background in the z-axis .
c# script please
Thanks
How do I move ground such as the video ?
I want to move background in the z-axis .
c# script please
Thanks
It’s not 3D. It’s actually a simple scrolling texture.
Material material = GetComponent<Renderer>().material;
material.SetTextureOffset("_MainTex", new Vector2(0f, material.GetTextureOffset("_MainTex").y + Time.deltaTime));
As for the rock getting larger as it gets closer, it’s a 2D trick as well. Set the scale of the rock as it moves away from the horizon (center of screen)…
float maxScale = 2.5f; // scale of object when it is closest
Vector3 screenPos = Camera.main.WorldToScreenPoint(transform.localPosition);
float objectScale = (1 - (screenPos.y / (Screen.height / 2))) * maxScale;
transform.localScale = Vector3.one * objectScale;