# NavMesh
# 说明
NavMesh命名空间提供与游戏地图导航网格相关的功能,用于获取地形信息、高度数据和碰撞检测等。
# 如何使用
#include "Noble.h"
// 获取位置的高度
Vector position(1000, 1000);
float height = NavMesh::GetHeightForPosition(position);
// 检查位置是否为墙体
bool isWall = NavMesh::IsWall(position);
// 检查位置是否为草丛
bool isGrass = NavMesh::IsGrass(position);
# GetCollisionFlags
eCollisionFlags GetCollisionFlags(Vector const& position)
获取指定位置的碰撞标志。
参数名字 | 参数类型 | 描述 |
---|---|---|
position | Vector const& | 需要检查碰撞的位置坐标 |
Vector position(1000, 1000);
eCollisionFlags flags = NavMesh::GetCollisionFlags(position);
// 检查是否包含墙体标志
if (flags & eCollisionFlags::Wall)
{
// 位置是墙体
}
# GetHeightForPosition
float GetHeightForPosition(Vector const& position)
获取指定位置的地形高度。
参数名字 | 参数类型 | 描述 |
---|---|---|
position | Vector const& | 需要获取高度的位置坐标 |
Vector position(1000, 1000);
float height = NavMesh::GetHeightForPosition(position);
# GetHeightForPosition
float GetHeightForPosition(float x, float y)
通过X和Y坐标获取指定位置的地形高度。
参数名字 | 参数类型 | 描述 |
---|---|---|
x | float | X坐标 |
y | float | Y坐标 |
float height = NavMesh::GetHeightForPosition(1000.0f, 1000.0f);
# IsGrass
bool IsGrass(Vector const& position)
检查指定位置是否为草丛。
参数名字 | 参数类型 | 描述 |
---|---|---|
position | Vector const& | 需要检查的位置坐标 |
Vector position(1000, 1000);
bool isGrass = NavMesh::IsGrass(position);
# IsInFOW
bool IsInFOW(Vector const& position)
检查指定位置是否在战争迷雾中。
参数名字 | 参数类型 | 描述 |
---|---|---|
position | Vector const& | 需要检查的位置坐标 |
Vector position(1000, 1000);
bool isInFOW = NavMesh::IsInFOW(position);
# IsRiver
bool IsRiver(Vector const& position)
检查指定位置是否为河道。
参数名字 | 参数类型 | 描述 |
---|---|---|
position | Vector const& | 需要检查的位置坐标 |
Vector position(1000, 1000);
bool isRiver = NavMesh::IsRiver(position);
# IsWall
bool IsWall(Vector const& position)
检查指定位置是否为墙体。
参数名字 | 参数类型 | 描述 |
---|---|---|
position | Vector const& | 需要检查的位置坐标 |
Vector position(1000, 1000);
bool isWall = NavMesh::IsWall(position);