empty

Unity3d Camera – Follow in X Direction



Follow Player – Smooth C# Script.

/////
public Transform target;
public float smoothing = 5f;
public Vector3 offset;

void Start()

// Calculate the initial offset.
offset = transform.position – target.position;

void FixedUpdate()

Vector3 targetCamPos = target.position + offset;
//Follow only in X Position..
transform.position = Vector3.Lerp (new Vector3 (transform.position.x, transform.position.y, -2f),
new Vector3 (targetCamPos.x , transform.position.y, -2f),
smoothing * Time.fixedDeltaTime );

/////


Post time: Jun-17-2017
INQUIRY NOW
  • * CAPTCHA: Please select the Flag