public void SetParentPanel(LightsPanel panel) { Debug.AssertFormat(m_ParentPanel == null, "Light Gizmo parent already set!"); m_ParentPanel = panel; App.Scene.PoseChanged += (TrTransform prev, TrTransform current) => { transform.rotation = current.rotation * m_Rotation_SS; transform.position = m_ParentPanel.LightWidgetPosition(transform.rotation); }; }
public void UpdateTransform() { // This is effectively called from LightsPanel.Start, which is before the gizmos // are entirely initialized and m_Light is null. // This is a patch fix. if (m_Light != null && m_ParentPanel != null) { Quaternion rotation = m_Light.transform.rotation; transform.position = m_ParentPanel.LightWidgetPosition(rotation); transform.rotation = Quaternion.LookRotation(rotation * Vector3.forward, (ViewpointScript.Head.position - transform.position).normalized); } }