I assigned teleportation target and the player to an object from where I want to be teleported. But it is not working at all, as in other examples players have RigidBody properties, on the other hand I don't have RigidBody in my NavMesh. Is this maybe an issue? I'm trying something like this:
private void OnTriggerEnter(Collider other)
{
thePlayer.transform.position = teleportTarget.transform.position;
}
This is my movement code:
public class Player : MonoBehaviour
{
[SerializeField]
private GameObject cameraPrefab;
private PlayerMovement playerMovement;
void Awake()
{
GameObject camera = Instantiate(cameraPrefab);
camera.GetComponent<PlayerCamera>().target = transform;
playerMovement = GetComponent<PlayerMovement>();
playerMovement.cam = camera.GetComponentInChildren<Camera>();
}
}
Any idea to fix this?
