Hi all, I am a bit stuck.
Can someone help me out please?
I am trying to re-create a 3D camera smooth follow player ahead like in Desert Strike game.
The camera is looking at the player from a top down view in a 2.5D style with orthographic.
So if a player is moving, the camera should smooth follow the player and look ahead of him.
So far, I got the smooth follow effect working, but I can’t find any tutorial or scripts for sale in the assets store.
Here is a code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamereFollow : MonoBehaviour
{
public Transform target;
public float smoothing = 5f;
Vector3 offset;
// Start is called before the first frame update
void Start()
{
offset = transform.position - target.position;
}
void FixedUpdate()
{
Vector3 targetCamPos = target.position + offset;
transform.position = Vector3.Lerp(transform.position, targetCamPos, smoothing * Time.deltaTime);
}
}
Thank you for any help!