NavigationMesh.pkg 3.4 KB

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