Skip to content

Commit

Permalink
fix: temp way to update default scene spawn points in the loader ui (#…
Browse files Browse the repository at this point in the history
…164)

Signed-off-by: Alptuğ Cırıt <[email protected]>
  • Loading branch information
mozhoku authored Sep 27, 2024
1 parent ddace19 commit 6aa55b1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
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);
}
}
}

0 comments on commit 6aa55b1

Please sign in to comment.