- Home /
Make Car look like it would move
Soo hey guys i am new to coding and things yu know, sooo my question is i want to make it look like my car would drive although it stays on the same place in a 3D game. I think i need a moving backround i guess? How can i do that?
And sorry for my bad english i am from Germany :/
Answer by yigitcihat · Oct 01, 2020 at 06:25 PM
You can Create 2 Image with " UI > Image" inside a canvas . And add which İmage you want to use for background . These 2 image will same. And they will moving. When First image passed, it would transform end of the queue. There is simple example :
float arkaPlanKonum;
//Second Background İmage distance. Middle of Image x coordinate
float distance = 18.35f;
// Start is called before the first frame update
void Start()
{
bgPosition = transform.position.x;
Debug.Log(bgPosition);
}
// Update is called once per frame
void Update()
{
if(bgPosition + distance < Camera.main.transform.position.x)
{
BackgroundMove();
}
}
void BackgroundMove()
{
bgPosition += (distance * 2);
//New position's X and Y coordinates which is replace BackGround İmage
Vector2 newPosition = new Vector2( bgPosition,10.35f);
// 10,35 is Heigh f image
transform.position = newPosition;
}
Your answer
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Make it look like Car would move. 0 Answers
How to create 2D random movement? 1 Answer