My character is stuttering when I have a smooth camera following me, although this doesn’t annoy me… It annoys the players that play this.
So is there any way to fix this?
The smooth camera looks really good imo and so does it to others, but only the stuttering needs to be fixed and it’ll look great.
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour {
public GameObject cameraTarget; // object to look at or follow
public GameObject player; // player object for moving
public float smoothTime = 0.1f; // time for dampen
public bool cameraFollowX = true; // camera follows on horizontal
public bool cameraFollowY = true; // camera follows on vertical
public bool cameraFollowHeight = true; // camera follow CameraTarget object height
public float cameraHeight = 2.5f; // height of camera adjustable
Vector2 velocity; // speed of camera movement
private Transform thisTransform; // camera Transform
// Use this for initialization
void Start()
{
thisTransform = transform;
}
// Update is called once per frame
void Update()
{
if (cameraFollowX)
{
thisTransform.position = new Vector3(Mathf.SmoothDamp(thisTransform.position.x, cameraTarget.transform.position.x, ref velocity.x, smoothTime), thisTransform.position.y, thisTransform.position.z);
}
if(cameraFollowY){
thisTransform.position = new Vector3(thisTransform.position.x, Mathf.SmoothDamp(thisTransform.position.y, cameraTarget.transform.position.y, ref velocity.y, smoothTime), thisTransform.position.z);
}
}
}
- YouTube Here is a video of what I’m talking about
welp that was a quick fix ! thx ;)
– Broewly