Commit 330a3b93 authored by ATREVI Dieudonne's avatar ATREVI Dieudonne
Browse files

Fix camera movement in command line

parent 968cd89a
......@@ -4703,8 +4703,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 43.7, y: -20.8}
m_SizeDelta: {x: 73.253, y: 24.54}
m_AnchoredPosition: {x: 45.002, y: -20.8}
m_SizeDelta: {x: 75.857, y: 24.54}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &408699402
MonoBehaviour:
......
......@@ -211,12 +211,12 @@ public class MenuManager : MonoBehaviour
ConfigReader.camResolution = CommandLine.GetCamResolution();
menu.SetActive(false);
configPanel.SetActive(false);
controlPanel.SetActive(false);
slider.SetActive(false);
topMenuPanel.SetActive(false);
cameraMovPanel.SetActive(false);
//menu.SetActive(false);
//configPanel.SetActive(false);
//controlPanel.SetActive(false);
//slider.SetActive(false);
//topMenuPanel.SetActive(false);
//cameraMovPanel.SetActive(false);
Time.timeScale = 1;
}
......
......@@ -28,7 +28,6 @@ using System.IO;
public class CamMvt : MonoBehaviour
{
#region camera modes name
public const string DEFAULT = "Default";
public const string FREE_MOVMENT = "Free_Movement";
......@@ -83,7 +82,7 @@ public class CamMvt : MonoBehaviour
private Vector3 _position_follow; // the current follow position
private Vector3 _position_first_person; // the current first person position
private Vector3 _position_torsum; // the current torsum position
string [] arguments;
//reset
public bool reset_active = false;
......@@ -97,7 +96,8 @@ public class CamMvt : MonoBehaviour
void Start()
{
panelMovCamera = GameObject.Find("/controlCanvas/cameraMovPanel");
camSelect = panelMovCamera.transform.Find("cameraType").GetComponent<Dropdown>();
camSelect = panelMovCamera.transform.Find("cameraType").GetComponent<Dropdown>();
arguments = System.Environment.GetCommandLineArgs();
}
/// <summary>
......@@ -171,7 +171,6 @@ public class CamMvt : MonoBehaviour
}
}
/// <summary>
/// Reads the parameter of the Usear Interface at every frame
/// </summary>
......@@ -185,7 +184,6 @@ public class CamMvt : MonoBehaviour
smoothFirstPersonView = panelMovCamera.transform.Find("SmoothView").GetComponent<Toggle>().isOn;
}
/// <summary>
/// It detects changes in the Current Camera Mode and intialize the parameters accordingly at every frame
/// </summary>
......@@ -313,7 +311,6 @@ public class CamMvt : MonoBehaviour
}
#endregion
#region events functions
///--------------------------------------------
///-------------- event functions -------------
......@@ -334,7 +331,6 @@ public class CamMvt : MonoBehaviour
{
transform.eulerAngles = _default_rotation;
transform.position = _default_position;
}
if (current_camera_mode == FOLLOW)
{
......@@ -358,6 +354,26 @@ public class CamMvt : MonoBehaviour
}
#endregion
public void camMovParamsCommandLine()
{
if(ConfigReader.camType == 0)
current_camera_mode = "Free_Movement";
else if(ConfigReader.camType == 1)
current_camera_mode = "Follow";
else if(ConfigReader.camType == 2)
current_camera_mode = "Look_At";
else if(ConfigReader.camType == 3)
current_camera_mode = "First_Person";
else if(ConfigReader.camType == 4)
current_camera_mode = "Torsum";
lookAt_Id = ConfigReader.camLookAtTarget;
follow_Id = ConfigReader.camFollowTarget;
followOnX = ConfigReader.camFollowOnX;
followOnY = ConfigReader.camFollowOnY;
lockFirstPersonView = ConfigReader.camLockFirstPerson;
smoothFirstPersonView = ConfigReader.camSmoothFirstPerson;
}
///--------------------------------------------
///---------------- main loop -----------------
......@@ -368,8 +384,16 @@ public class CamMvt : MonoBehaviour
/// ----------------------------
/// UPDATE VALUES --------------
/// ----------------------------
readCameraMovParamOnScene();
check_changes_and_initialize();
if (arguments.Length >1 && !Application.isEditor)
{
camMovParamsCommandLine();
}
else
{
readCameraMovParamOnScene();
check_changes_and_initialize();
}
check_for_events();
#endregion
......@@ -402,10 +426,6 @@ public class CamMvt : MonoBehaviour
// --------------------------------
// TRANSLATION --------------------
// --------------------------------
if (current_camera_mode == DEFAULT)
{
transform.position = _default_position;
}
if(current_camera_mode == LOOK_AT)
{
transform.position = new Vector3(transform.position.x, _default_position.y, transform.position.z);
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<ConfigData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env_filesPath>./Scenarios/ExampleFirstPerson/</env_filesPath>
<env_obstFile>./Scenarios/Decor/obstExampleFirstPerson.xml</env_obstFile>
......@@ -9,13 +9,13 @@
</env_stageInfos>
<cam>
<cameraType typeID="3" />
<position x="-32.01872" y="-1.759027" z="3.32442" />
<rotation x="30.5008" y="3.963564E-06" z="88.99989" />
<lookAtAgent agentID="2" />
<position x="-22.27659" y="-2.188338" z="1.587071" />
<rotation x="29.75006" y="-9.833855E-07" z="92.63902" />
<lookAtAgent agentID="-1" />
<followAgent agentID="2" followOnX="true" followOnY="true" lockFirstPerson="false" smoothFirstPerson="true" />
<CamResolution x="-1" y="-1" />
</cam>
<recording start="0" end="0" framerate="15" width="320" height="240">
<recording start="1" end="10" 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" />
......@@ -24,7 +24,7 @@
<saveImgOpticalFlow record="false" quality="8" width="-1" height="-1" motionVector="false" />
<saveBodyBoundingBoxes record="false" />
<saveHeadBoundingBoxes record="false" />
<saveDir>./Output/Follow/</saveDir>
<saveDir>./Output/FirstPerson/</saveDir>
</recording>
<AgentColorList />
</ConfigData>
\ No newline at end of file
</ConfigData>
......@@ -15,7 +15,7 @@
<followAgent agentID="2" followOnX="true" followOnY="true" lockFirstPerson="false" smoothFirstPerson="true" />
<CamResolution x="-1" y="-1" />
</cam>
<recording start="0" end="0" framerate="15" width="320" height="240">
<recording start="1" end="10" 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" />
......@@ -27,4 +27,4 @@
<saveDir>./Output/Follow/</saveDir>
</recording>
<AgentColorList />
</ConfigData>
\ No newline at end of file
</ConfigData>
......@@ -15,7 +15,7 @@
<followAgent agentID="-1" followOnX="false" followOnY="false" lockFirstPerson="false" smoothFirstPerson="true" />
<CamResolution x="-1" y="-1" />
</cam>
<recording start="0" end="0" framerate="15" width="-1" height="-1">
<recording start="1" end="10" framerate="15" width="-1" height="-1">
<saveImgOriginal record="true" quality="8" width="1" height="-1" />
<saveImgSegmentation record="true" quality="8" width="1920" height="1080" />
<saveImgCategories record="true" quality="8" width="1280" height="720" />
......@@ -27,4 +27,4 @@
<saveDir>./Output/LookAt/</saveDir>
</recording>
<AgentColorList />
</ConfigData>
\ No newline at end of file
</ConfigData>
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