Hi guys!
I'm having a small problem with my camera follow script. Every few seconds the camera jitters on the x axis, but I'm not sure why.
Here is my script so far:
public float addPos;
public Transform target;
public GameObject asteroid;
void Update(){
asteroid = GameObject.Find("Sphere(Clone)");
}
void LateUpdate () {
if(gameObject.name == "Main Camera"){
if(!Astronaut.isDead){
transform.position = new Vector3(target.position.x + addPos, transform.position.y, transform.position.z);
}else if(asteroid != null && Astronaut.isDead){
transform.position = new Vector3(asteroid.transform.position.x + addPos, transform.position.y, transform.position.z);
}
}
if(gameObject.name == "Score" && !Astronaut.didStart){
transform.position = new Vector3(target.position.x, transform.position.y, transform.position.z);
}
}
I've tried changing the LateUpdate to Update/FixedUpdate (didn't solve anything), and I also set most of my RigidBody's to Interpolate (made it a little bit better).
I really hope that you guys can help me!
-Collin
*Edit*
I forgot to mention, but the problem only happens when the player screen wraps, it causes the asteroids to jitter. Here is a .gif of what it looks like: https://twitter.com/Slader166/status/561758957916946432
↧