Add support for using NavAreas for navigation

This commit is contained in:
Wojtek Figat
2021-01-18 13:18:26 +01:00
parent ba050b9eaa
commit fdc8e371c4
10 changed files with 155 additions and 9 deletions

View File

@@ -7,6 +7,36 @@ namespace FlaxEditor.Content.Settings
{
partial class NavigationSettings
{
/// <summary>
/// Initializes a new instance of the <see cref="NavigationSettings"/> class.
/// </summary>
public NavigationSettings()
{
// Init navmeshes
NavMeshes = new NavMeshProperties[1];
ref var navMesh = ref NavMeshes[0];
navMesh.Name = "Default";
navMesh.Color = Color.Green;
navMesh.Rotation = Quaternion.Identity;
navMesh.Agent.Radius = 34.0f;
navMesh.Agent.Height = 144.0f;
navMesh.Agent.StepHeight = 35.0f;
navMesh.Agent.MaxSlopeAngle = 60.0f;
// Init nav areas
NavAreas = new NavAreaProperties[2];
ref var areaNull = ref NavAreas[0];
areaNull.Name = "Null";
areaNull.Color = Color.Transparent;
areaNull.Id = 0;
areaNull.Cost = float.MaxValue;
ref var areaWalkable = ref NavAreas[1];
areaWalkable.Name = "Walkable";
areaWalkable.Color = Color.Transparent;
areaWalkable.Id = 63;
areaWalkable.Cost = 1;
}
// [Deprecated on 12.01.2021, expires on 12.01.2022]
private void UpgradeToNavMeshes()
{