Offset Scrolling on a plane moving with Camera
Hi all, i'm making a game with a spatialshift moving in the infinite space. So i put a black background as chilld of Camera (its position update everytime to be the same position as the spatialship), i can move the Spatialship in the scene , the camera and the black background follow it.
everything work fine, but now i want to put an transparent image with white spots (its supposed to be the stars) so when i move the spatialShip, it look like the stars move to the opposed way.
I put this texture on a plane and put this plane in the Camera children's .
i use this script (c#) :
public GameObject player; float scrollSpeed; float scrollSpeed2; void FixedUpdate(){ float offset = Time.time* player.GetComponent<Rigidbody2D>().velocity.x *0.2f; float offset2 = Time.time * player.GetComponent<Rigidbody2D>().velocity.y *0.2f; GetComponent<Renderer>().material.mainTextureOffset=(new Vector2(offset,offset2)*0.2f); }
The texture move but it's not smooth at all, i tried it with Update() and Fixedupdate() and nothing change...
Im a beginner so every tips / advice are welcome.
Thanks for reading and thanks for your help
Your answer
Follow this Question
Related Questions
Help with smooth camera movement 0 Answers
SmoothDamp and rounding problem 3 Answers