NavigationMesh.pkg 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. // void FindPath(PODVector<Vector3>& dest, const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
  28. tolua_outside PODVector<Vector3> NavigationMeshFindPath @ FindPath(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
  29. Vector3 GetRandomPoint();
  30. Vector3 GetRandomPointInCircle(const Vector3& center, float radius, const Vector3& extents = Vector3::ONE);
  31. float GetDistanceToWall(const Vector3& point, float radius, const Vector3& extents = Vector3::ONE);
  32. Vector3 Raycast(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
  33. void DrawDebugGeometry(bool depthTest);
  34. int GetTileSize() const;
  35. float GetCellSize() const;
  36. float GetCellHeight() const;
  37. float GetAgentHeight() const;
  38. float GetAgentRadius() const;
  39. float GetAgentMaxClimb() const;
  40. float GetAgentMaxSlope() const;
  41. float GetRegionMinSize() const;
  42. float GetRegionMergeSize() const;
  43. float GetEdgeMaxLength() const;
  44. float GetEdgeMaxError() const;
  45. float GetDetailSampleDistance() const;
  46. float GetDetailSampleMaxError() const;
  47. const Vector3& GetPadding() const;
  48. bool IsInitialized() const;
  49. const BoundingBox& GetBoundingBox() const;
  50. BoundingBox GetWorldBoundingBox() const;
  51. IntVector2 GetNumTiles() const;
  52. tolua_property__get_set int tileSize;
  53. tolua_property__get_set float cellSize;
  54. tolua_property__get_set float cellHeight;
  55. tolua_property__get_set float agentHeight;
  56. tolua_property__get_set float agentRadius;
  57. tolua_property__get_set float agentMaxClimb;
  58. tolua_property__get_set float agentMaxSlope;
  59. tolua_property__get_set float regionMinSize;
  60. tolua_property__get_set float regionMergeSize;
  61. tolua_property__get_set float edgeMaxLength;
  62. tolua_property__get_set float edgeMaxError;
  63. tolua_property__get_set float detailSampleDistance;
  64. tolua_property__get_set float detailSampleMaxError;
  65. tolua_property__get_set Vector3& padding;
  66. tolua_readonly tolua_property__is_set bool initialized;
  67. tolua_readonly tolua_property__get_set BoundingBox& boundingBox;
  68. tolua_readonly tolua_property__get_set BoundingBox worldBoundingBox;
  69. tolua_readonly tolua_property__get_set IntVector2 numTiles;
  70. };
  71. ${
  72. PODVector<Vector3> NavigationMeshFindPath(NavigationMesh* navMesh, const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE)
  73. {
  74. PODVector<Vector3> dest;
  75. navMesh->FindPath(dest, start, end, extents);
  76. return dest;
  77. }
  78. $}