OK so I need help -.-’ I am very new to this and I only really know the basics of programming in Java and C++ but I am trying to create a very basic 2D Top/Down game in unity (of course using C#). I have the player movement, I have the maps, I can get the camera to follow the player (without making the player the parent to the camera) using a script.
I should add that this game is pixel art as well. I removed anti-aliasing and used pixel snap to make sure there aren’t any random lines poping up.
However, even with damping/smoothing the camera still Jitters to some extent and don’t know how to prevent this.
Also, since the camera follows the player it lags behind the player and not directly on him. so when he is moving left, the left side of the screen is the smallest portion, and therefore you cant see very much ahead of him. Increasing the Cam speed does make it so that it can keep up with the player but it ends up adding more jitteryness.
I would like and RPG-like feel to this game and wanted to get the camera to surpass the player by a couple of units to make it so that the player can see ahead of him (in any direction he chooses).
Since it is a top down, I shouldn’t have used the term “left” but West. As the player can go; North, North-East, East, South-East, South, South-West, West, North-West.
(edit) The code I have is simple and I haven’t added smoothing to this one, so the camera just clips a certain distance from the player (ahead) also, the random lines have shown back up now and I don’t know why, but if i play it in maximized the lines disappear. But the Jitteryness is still visible PLZ HELP!!
public class CameraBehavior : MonoBehaviour {
public GameObject target;
private Vector3 offset = new Vector3(0f, 0f, -11f);
private Vector3 moveOffset;
// Use this for initialization
void Start () {
transform.position = target.transform.position + offset;
}
// Update is called once per frame
void FixedUpdate () {
moveOffset = new Vector3(Input.GetAxisRaw("Horizontal") * 1.1f, Input.GetAxisRaw("Vertical") * 1.1f, 0f);
transform.position = target.transform.position + moveOffset + offset;
}
}