Add NavAreaProperties

This commit is contained in:
Wojtek Figat
2021-01-18 11:42:17 +01:00
parent 2ae78b9afd
commit c1216a4318
2 changed files with 45 additions and 0 deletions

View File

@@ -133,6 +133,11 @@ bool NavAgentMask::operator==(const NavAgentMask& other) const
return Mask == other.Mask; return Mask == other.Mask;
} }
bool NavAreaProperties::operator==(const NavAreaProperties& other) const
{
return Name == other.Name && Id == other.Id && Math::NearEqual(Cost, other.Cost);
}
bool NavMeshProperties::operator==(const NavMeshProperties& other) const bool NavMeshProperties::operator==(const NavMeshProperties& other) const
{ {
return Name == other.Name && Quaternion::NearEqual(Rotation, other.Rotation, 0.001f) && Agent == other.Agent; return Name == other.Name && Quaternion::NearEqual(Rotation, other.Rotation, 0.001f) && Agent == other.Agent;

View File

@@ -137,3 +137,43 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(NavMeshHit);
/// </summary> /// </summary>
API_FIELD() Vector3 Normal; API_FIELD() Vector3 Normal;
}; };
/// <summary>
/// The navigation area properties container for navmesh building and navigation runtime.
/// </summary>
API_STRUCT() struct FLAXENGINE_API NavAreaProperties : ISerializable
{
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE_MINIMAL(NavAreaProperties);
/// <summary>
/// The area type name. Identifies different types of the areas.
/// </summary>
API_FIELD(Attributes="EditorOrder(0)")
String Name;
/// <summary>
/// The area type color (for debugging). Alpha channel is used to blend with navmesh color (alpha 0 to use navmesh color only).
/// </summary>
API_FIELD(Attributes="EditorOrder(10)")
Color Color = Color::Red;
/// <summary>
/// The area id. It must be unique for the project. Valid range 0-63. Value 0 is reserved for Null areas (empty, non-navigable areas).
/// </summary>
API_FIELD(Attributes="EditorOrder(20), Limit(0, 63)")
byte Id = 1;
/// <summary>
/// The cost scale for the area traversal for agents. The higher the cost, the less likely agent wil choose the path that goes over it. For instance, areas that are harder to move like sand should have higher cost for proper path finding.
/// </summary>
API_FIELD(Attributes="EditorOrder(30), Limit(0, 100000, 0.1f)")
float Cost = 1;
bool operator==(const NavAreaProperties& other) const;
bool operator!=(const NavAreaProperties& other) const
{
return !operator==(other);
}
};