- Home /
How do I stop objects from ghosting on screen?
I am working on a 2D endless runner and I have a problem with my objects appearing to ghost as the player object moves past them. I am attaching my camera to my player object through script, which I've pasted below. I have tried to put the camera code into Update, LateUpdate, and FixedUpdate with no change in behavior.
Here is a video of the problem: https://www.youtube.com/watch?v=N5f3G9dd_SQ&feature=youtu.be You can really see it on the clouds and coins.
Here is the code for my camera:
 using UnityEngine;
 using System.Collections;
 
 public class CameraFollow : MonoBehaviour {
 
     public Transform objectToFollow;
     float bottom = 0.0f;
     float lead = 10f;
     float above = 5f;
     float minView = 16;
     
     void Start () {
 
     }
 
     void FixedUpdate(){
         float height = objectToFollow.position.y + above - bottom;
         height = Mathf.Max(height,minView);
         height /= 2.0f;
         Camera.main.orthographicSize = height;
         transform.position = new Vector3 (objectToFollow.position.x + lead, bottom + height, transform.position.z);
     }
 }
Answer by Robs · Apr 18, 2014 at 04:06 AM
The object that the camera was following did not have any interpolation on it. Once I added interpolation to the object, the problem went away.
Your answer
 
 
             Follow this Question
Related Questions
Resizing orthographic camera to fit 2d sprite on screen 1 Answer
Orthographic Camera settings for a 2D game 1 Answer
Iphone 2d camera settings 1 Answer
2D Camera sizing and movement 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                