Commit a347d4fc authored by ATREVI Dieudonne's avatar ATREVI Dieudonne
Browse files

Add camera type on the GUI to allow usage in player mode

parent 7391a7b3
This diff is collapsed.
......@@ -43,7 +43,7 @@ public class MenuManager : MonoBehaviour
Camera cam; // the main camera
Dropdown configFilesMenu; // GUI object to select the scenario
GameObject menu; // the menu gameObject
public GameObject panel; // the panel gameObject
public GameObject panel, cameraMovPanel; // the panel gameObject
public static GameObject controlPanel; // The play, pause and stop control panel
public GameObject configPanel; // the panel to set the config parameters
public GameObject topMenuPanel; // the top menu panel
......@@ -70,6 +70,9 @@ public class MenuManager : MonoBehaviour
topMenuPanel = GameObject.Find("/controlCanvas/fakePanel");
topMenuPanel.SetActive(false);
cameraMovPanel = GameObject.Find("/controlCanvas/cameraMovPanel");
cameraMovPanel.SetActive(false);
configPanel = GameObject.FindGameObjectWithTag("configPanel");
obstReader = new ObstaclesReader();
......@@ -210,6 +213,7 @@ public class MenuManager : MonoBehaviour
configPanel.SetActive(false);
controlPanel.SetActive(true);
topMenuPanel.SetActive(true);
cameraMovPanel.SetActive(true);
//slider.SetActive(true);
GameObject.Find("/controlCanvas/fakePanel/topMenu").SetActive(false);
}
......
......@@ -23,12 +23,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
public class CamMvt : MonoBehaviour
{
#region attributes
// different camera types
public enum CameraType
......@@ -70,15 +70,15 @@ public class CamMvt : MonoBehaviour
private Vector3 _position_first_person; // the current first person position
private Vector3 _position_torsum; // the current torsum position
private GameObject camTypePanel;
#endregion
// Use this for initialization
void Start()
{
_camera_type = CameraType.Default;
//_camera_type = CameraType.Default;
}
/// <summary>
/// Initialize the targets of the camera movement
/// </summary>
......@@ -165,17 +165,28 @@ public class CamMvt : MonoBehaviour
#region ROTATION
// ------------------------------
// ROTATION - LOOKING AT AN AGENT
camTypePanel = GameObject.Find("/controlCanvas/cameraMovPanel");
Dropdown camSelect = camTypePanel.transform.Find("cameraType").GetComponent<Dropdown>();
if (lookAt_Agent != null && activateLookAt)
{
transform.LookAt(lookAt_Agent.transform);
transform.LookAt(lookAt_Agent.transform);
}
if (lockFirstPersonView)
{
if (_camera_type == CameraType.First_Person)
/*if (_camera_type == CameraType.First_Person)
{
transform.forward = agent_reference_transform.forward;
}
else if (_camera_type == CameraType.Torsum)
{
transform.forward = agent_reference_transform.forward;
}*/
if (camSelect.options[camSelect.value].text == "First_Person")
{
transform.forward = agent_reference_transform.forward;
}
else if (camSelect.options[camSelect.value].text == "Torsum")
{
transform.forward = agent_reference_transform.forward;
}
......@@ -200,26 +211,39 @@ public class CamMvt : MonoBehaviour
// --------------------------------
// TRANSLATION - FOLLOWING AN AGENT
if (_camera_type == CameraType.Follow || _camera_type == CameraType.Default)
/*if (_camera_type == CameraType.Follow || _camera_type == CameraType.Default )
{
transform.position = _position_follow;
}
else if (_camera_type == CameraType.First_Person)
else if (_camera_type == CameraType.First_Person )
{
transform.position = _position_first_person;
}
else if (_camera_type == CameraType.Torsum)
else if (_camera_type == CameraType.Torsum )
{
transform.position = _position_torsum;
}*/
if (camSelect.options[camSelect.value].text == "Default" || camSelect.options[camSelect.value].text == "Follow")
{
transform.position = _position_follow;
}
else if (camSelect.options[camSelect.value].text == "First_Person")
{
transform.position = _position_first_person;
}
else if (camSelect.options[camSelect.value].text == "Torsum")
{
transform.position = _position_torsum;
}
}
#endregion
}
}
#region Additional Functions
//additional functions
//additional functions
/// <summary>
/// Find the head transform and return it
/// </summary>
......@@ -294,6 +318,6 @@ public class CamMvt : MonoBehaviour
}
return null;
}
}
}
#endregion
}
}
\ No newline at end of file
......@@ -9,12 +9,12 @@
</env_stageInfos>
<cam>
<position x="-30" y="-3" z="5" />
<rotation x="30.00002" y="0" z="90" />
<rotation x="30.32365" y="0" z="92.53606" />
<lookAtAgent agentID="-1" />
<followAgent agentID="0" followOnX="true" followOnY="false" />
<CamResolution x="-1" y="-1" />
</cam>
<recording start="1" end="10" framerate="15" width="320" height="240">
<recording start="0" end="0" framerate="15" width="320" height="240">
<saveImgOriginal record="true" quality="8" width="-1" height="-1" />
<saveImgSegmentation record="false" quality="8" width="-1" height="-1" />
<saveImgCategories record="false" quality="8" width="-1" height="-1" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment