Hi !
I have a problem:
when i teleport my character to a distant place the camera follows but it goes to far and came back to the character.
I tryed to stop the damping and setting the lookaheadTime to zero but now I have a nullreference, but still, everything is supposed to be on place I don’t get it.
here is my script teleporting my character:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class Spawn : MonoBehaviour {
public GameObject SpawningCharacter;
public CinemachineVirtualCamera cameraObj;
private CinemachineFramingTransposer camcomposer;
private void Start()
{
camcomposer=cameraObj.GetCinemachineComponent<CinemachineFramingTransposer>();
}
public void Teleport()
{
//lookaheadtime 0.5->0
//damping x 1 ->0
//damping y 1 ->0
camcomposer.m_LookaheadTime=0f;
camcomposer.m_XDamping=0f;
camcomposer.m_YDamping=0f;
SpawningCharacter.transform.position = transform.position;
camcomposer.m_LookaheadTime=0.5f;
camcomposer.m_XDamping=1f;
camcomposer.m_YDamping=1f;
}
}
and the Virtual camera is on it (attached file).
I don’t know why I have this null reference…