NavigationMesh.pkg 3.8 KB

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