NavigationMesh.pkg 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. $#include "Navigation/NavigationMesh.h"
  2. enum NavmeshPartitionType
  3. {
  4. NAVMESH_PARTITION_WATERSHED = 0,
  5. NAVMESH_PARTITION_MONOTONE
  6. };
  7. struct NavigationGeometryInfo
  8. {
  9. Component* component_ @ component;
  10. unsigned lodLevel_ @ lodLevel;
  11. Matrix3x4 transform_ @ transform;
  12. BoundingBox boundingBox_ @ boundingBox;
  13. };
  14. class NavigationMesh : public Component
  15. {
  16. void SetTileSize(int size);
  17. void SetCellSize(float size);
  18. void SetCellHeight(float height);
  19. void SetAgentHeight(float height);
  20. void SetAgentRadius(float radius);
  21. void SetAgentMaxClimb(float maxClimb);
  22. void SetAgentMaxSlope(float maxSlope);
  23. void SetRegionMinSize(float size);
  24. void SetRegionMergeSize(float size);
  25. void SetEdgeMaxLength(float length);
  26. void SetEdgeMaxError(float error);
  27. void SetDetailSampleDistance(float distance);
  28. void SetDetailSampleMaxError(float error);
  29. void SetPadding(const Vector3& padding);
  30. void SetAreaCost(unsigned areaID, float cost);
  31. bool Build();
  32. bool Build(const BoundingBox& boundingBox);
  33. void SetPartitionType(NavmeshPartitionType aType);
  34. void SetDrawOffMeshConnections(bool enable);
  35. void SetDrawNavAreas(bool enable);
  36. Vector3 FindNearestPoint(const Vector3& point, const Vector3& extents = Vector3::ONE);
  37. Vector3 MoveAlongSurface(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE, int maxVisited = 3);
  38. tolua_outside const PODVector<Vector3>& NavigationMeshFindPath @ FindPath(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
  39. Vector3 GetRandomPoint();
  40. Vector3 GetRandomPointInCircle(const Vector3& center, float radius, const Vector3& extents = Vector3::ONE);
  41. float GetDistanceToWall(const Vector3& point, float radius, const Vector3& extents = Vector3::ONE);
  42. Vector3 Raycast(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
  43. void DrawDebugGeometry(bool depthTest);
  44. int GetTileSize() const;
  45. float GetCellSize() const;
  46. float GetCellHeight() const;
  47. float GetAgentHeight() const;
  48. float GetAgentRadius() const;
  49. float GetAgentMaxClimb() const;
  50. float GetAgentMaxSlope() const;
  51. float GetRegionMinSize() const;
  52. float GetRegionMergeSize() const;
  53. float GetEdgeMaxLength() const;
  54. float GetEdgeMaxError() const;
  55. float GetDetailSampleDistance() const;
  56. float GetDetailSampleMaxError() const;
  57. const Vector3& GetPadding() const;
  58. float GetAreaCost(unsigned areaID) const;
  59. bool IsInitialized() const;
  60. const BoundingBox& GetBoundingBox() const;
  61. BoundingBox GetWorldBoundingBox() const;
  62. IntVector2 GetNumTiles() const;
  63. NavmeshPartitionType GetPartitionType();
  64. bool GetDrawOffMeshConnections() const;
  65. bool GetDrawNavAreas() const;
  66. tolua_property__get_set int tileSize;
  67. tolua_property__get_set float cellSize;
  68. tolua_property__get_set float cellHeight;
  69. tolua_property__get_set float agentHeight;
  70. tolua_property__get_set float agentRadius;
  71. tolua_property__get_set float agentMaxClimb;
  72. tolua_property__get_set float agentMaxSlope;
  73. tolua_property__get_set float regionMinSize;
  74. tolua_property__get_set float regionMergeSize;
  75. tolua_property__get_set float edgeMaxLength;
  76. tolua_property__get_set float edgeMaxError;
  77. tolua_property__get_set float detailSampleDistance;
  78. tolua_property__get_set float detailSampleMaxError;
  79. tolua_property__get_set Vector3& padding;
  80. tolua_property__get_set NavmeshPartitionType partitionType;
  81. tolua_property__get_set bool drawOffMeshConnections;
  82. tolua_property__get_set bool drawNavAreas;
  83. tolua_readonly tolua_property__is_set bool initialized;
  84. tolua_readonly tolua_property__get_set BoundingBox& boundingBox;
  85. tolua_readonly tolua_property__get_set BoundingBox worldBoundingBox;
  86. tolua_readonly tolua_property__get_set IntVector2 numTiles;
  87. };
  88. ${
  89. const PODVector<Vector3>& NavigationMeshFindPath(NavigationMesh* navMesh, const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE)
  90. {
  91. static PODVector<Vector3> dest;
  92. dest.Clear();
  93. navMesh->FindPath(dest, start, end, extents);
  94. return dest;
  95. }
  96. $}