public void SetLookAt(Transform lookAtObject, LookAtAxis axis) { if (m_transformComponent == null) m_transformComponent = this.GetComponent<Transform>(); if (m_transformComponent != null) { Vector3 currentLookAtAxis = Vector3.zero; switch (axis) { case LookAtAxis.Up: currentLookAtAxis = m_transformComponent.up; break; case LookAtAxis.Down: currentLookAtAxis = -m_transformComponent.up; break; case LookAtAxis.Right: currentLookAtAxis = m_transformComponent.right; break; case LookAtAxis.Left: currentLookAtAxis = -m_transformComponent.right; break; case LookAtAxis.Forward: currentLookAtAxis = m_transformComponent.forward; break; } m_transformComponent.LookAt(LookAtObject, currentLookAtAxis); } }
public void SetLookAt(Transform lookAtObject, LookAtAxis axis) { if (m_transformComponent == null) { m_transformComponent = this.GetComponent <Transform>(); } if (m_transformComponent != null) { Vector3 currentLookAtAxis = Vector3.zero; switch (axis) { case LookAtAxis.Up: currentLookAtAxis = m_transformComponent.up; break; case LookAtAxis.Down: currentLookAtAxis = -m_transformComponent.up; break; case LookAtAxis.Right: currentLookAtAxis = m_transformComponent.right; break; case LookAtAxis.Left: currentLookAtAxis = -m_transformComponent.right; break; case LookAtAxis.Forward: currentLookAtAxis = m_transformComponent.forward; break; } m_transformComponent.LookAt(LookAtObject, currentLookAtAxis); } }