Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: temp way to update default scene spawn points in the loader ui #164

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Assets/AWSIM/Scripts/Loader/EgosManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ public void LoadUI()
egoUISelecor.RefreshShownValue();
}

// Sin cont.
public void UpdateMapDefaultSpawn(double mapPosX, double mapPosY, double mapPosZ, double mapRotX, double mapRotY, double mapRotZ)
{
positionInputFields[0].text = mapPosX.ToString();
positionInputFields[1].text = mapPosY.ToString();
positionInputFields[2].text = mapPosZ.ToString();
rotationInputFields[0].text = mapRotX.ToString();
rotationInputFields[1].text = mapRotY.ToString();
rotationInputFields[2].text = mapRotZ.ToString();
}

/// <summary>
/// Gets the position from the GUI input fields.
/// </summary>
Expand Down
38 changes: 36 additions & 2 deletions Assets/AWSIM/Scripts/Loader/MapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ public class MapManager : MonoBehaviour, IConfigurableManager
/// </summary>
public Action<LogLevel, string> Log { get; set; }

private EgosManager _egosManager;

public void Start()
{
if (!forbiddenSceneNames.Contains(SceneManager.GetActiveScene().name))
{
forbiddenSceneNames.Add(SceneManager.GetActiveScene().name);
}
_egosManager = GameObject.FindObjectOfType<EgosManager>();
}

/// <summary>
Expand Down Expand Up @@ -85,6 +88,7 @@ public void LoadUI()
}
mapUISelecor.value = 0;
mapUISelecor.RefreshShownValue();
mapUISelecor.onValueChanged.AddListener(delegate { UpdateFields(mapUISelecor.options[mapUISelecor.value]); });
}

/// <summary>
Expand All @@ -109,9 +113,39 @@ public bool LoadConfig(AWSIMConfiguration config)
return false;
}
}

return true;
}
}

// Sin (other part is in EgosManager.cs)
private void UpdateFields(Dropdown.OptionData data)
{
double mapPosX = 0;
double mapPosY = 0;
double mapPosZ = 0;
double mapRotX = 0;
double mapRotY = 0;
double mapRotZ = 0;

switch (data.text)
{
case "Shinjuku" or "ShinjukuNight":
mapPosX = 81380.72;
mapPosY = 49918.78;
mapPosZ = 41.57;
mapRotX = 0;
mapRotY = 0;
mapRotZ = 35;
break;
case "Parking Area":
mapPosX = 81580.52;
mapPosY = 50083.58;
mapPosZ = 41;
mapRotX = 0;
mapRotY = 0;
mapRotZ = 100;
break;
}
_egosManager.UpdateMapDefaultSpawn(mapPosX, mapPosY, mapPosZ, mapRotX, mapRotY, mapRotZ);
}
}
}
Loading