The camera is parented to an animated character head bone to prevent it from drifting off. The issue is the camera is shaky. How do I stabilize it?
I suggest you don’t parent the camera to the head bone and instead write a script for following the head bone. The cameras movement should be updated in LateUpdate and you can lerp its position to stabilise it. I’ve used a follow script like this:
public class CameraFollow : MonoBehaviour
{
public GameObject ToFollow;
public float Speed;
Vector3 offset;
void Start()
{
offset = transform.position - ToFollow.transform.position;
}
void LateUpdate()
{
if (ToFollow == null) return;
var targetPos = ToFollow.transform.position + offset;
transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime * Speed);
}
}
Set the characters head to the ToFollow parameter. Adjust the speed to what you need, start with a value of 1. The camera will then follow the head smoothly.
Thnx man I’ll tinker with it when I go home