Working on a game based only on the Y axis, I can get the player to respawn but can’t get the camera to reset. This is my camera script and the respawn script:
Respawn:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KillPlayer : MonoBehaviour {
[SerializeField]Transform spawnPoint;
void OnCollisionEnter2D(Collision2D col)
{
if (col.transform.CompareTag("Player"))
col.transform.position = spawnPoint.position;
}
}
Camera:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowCamera : MonoBehaviour{
public Transform target;
public float smoothSpeed = .3f;
private Vector3 currentVelocity;
void LateUpdate (){
if (target.position.y > transform.position.y)
{
Vector3 newPos = new Vector3(transform.position.x, target.position.y, transform.position.z);
transform.position = Vector3.SmoothDamp(transform.position, newPos, ref currentVelocity, smoothSpeed * Time.deltaTime);
}
}
}
any idea how I can implement a camera position resent upon death? I can’t figure it out for the life of me haha