Beispiel #1
0
    void m_Camera_setView(CameraView cv)
    {
        switch (cv)
        {
        case CameraView.view1:
        {
            float V_fov = m_Camera.fieldOfView;
            float target_camera_bottom_Y = -(float)m_WheelModel.rim_d;    // - 0.20f;
            float V_dist    = Mathf.Tan(V_fov * Mathf.Deg2Rad / 2.0f) * target_camera_bottom_Y;
            float cam_angle = -45 * Mathf.Deg2Rad;

            m_Camera.transform.position =
                m_WheelModel.get_hub_pos().toVector3() - new Vector3(Mathf.Cos(cam_angle) * (float)m_WheelModel.rim_d / 2, -Mathf.Sin(cam_angle) * (float)m_WheelModel.rim_d / 2, 0)
                + new Vector3(0, 0, 0.05f);

            m_Camera.transform.rotation = Quaternion.Euler(45 / 2, 90, 0);
            break;
        }

        case CameraView.view2:
        {
            m_Camera.transform.position =
                m_WheelModel.get_hub_pos().toVector3() + new Vector3(-0.040f, -(float)m_WheelModel.rim_d / 2 - m_rim_profile_height * 1.5f, m_rim_profile_width);

            m_Camera.transform.rotation = Quaternion.Euler(0, 90, 0);
            break;
        }
        }
    }