- Home /
Question by
SangOk1994 · Jun 12, 2020 at 10:00 AM ·
cameraoffsetnormalized
Cinemachine Virtual Camera offset not normalized
Instead of using camera path with fixed coordinate,
I'm making [Relative Camera Path] for virtual camera, to make my path work where ever start position and lookAt position are.
Setting path was successful, but I have problem in making camera to follow new path
I use [Normalized] as position unit, but position offset is not normalized.
position offset should be 0 in cameraPath[0], 1 in cameraPath[cameraPath.length -1]
but it is -0.9 and 0.1
it's code relatived to setting path
class CameraAimPath{
public Transform StartPoint;
public GameObjectReference lobbyCharacter;
public CinemachineVirtualCamera virtualCamera;
public CinemachinePath path;
private CinemachineComposer composer;
private CinemachineTrackedDolly trackDolly;
private void OnEnable()
{
trackDolly = virtualCamera.GetCinemachineComponent<CinemachineTrackedDolly>();
if (trackDolly == null)
{
Debug.LogError("dolly is null");
return;
}
composer = virtualCamera.GetCinemachineComponent<CinemachineComposer>();
lobbyCharacter.AddListener(CharacterChanged);
CharacterChanged();
}
private void CharacterChanged()
{
realPath.SetPath(StartPoint.position, virtualCamera.LookAt.position);
path.m_Waypoints = realPath.GetPath(); // setting path works fine
path.transform.position = Vector3.zero;
trackDolly.m_PositionUnits = CinemachinePathBase.PositionUnits.Normalized;
trackDolly.m_AutoDolly.m_SearchRadius = 0;
composer.m_HorizontalDamping = 0f;
composer.m_VerticalDamping = 0f;
trackDolly.m_XDamping = 0f;
trackDolly.m_YawDamping = 0f;
trackDolly.m_ZDamping = 0f;
}
}
I wonder why this happen and how to fix.
Any anser will be great thanks
notnormalized0.png
(191.1 kB)
Comment