NavigationMesh.pkg 3.7 KB

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