$#include "NavigationMesh.h" /// Description of a navigation mesh geometry component, with transform and bounds information. struct NavigationGeometryInfo { /// Component. Component* component_; /// Geometry LOD level if applicable. unsigned lodLevel_; /// Transform relative to the navigation mesh root node. Matrix3x4 transform_; /// Bounding box relative to the navigation mesh root node. BoundingBox boundingBox_; }; /// Navigation mesh component. Collects the navigation geometry from child nodes with the Navigable component and responds to path queries. class NavigationMesh : public Component { public: /// Set tile size. void SetTileSize(int size); /// Set cell size. void SetCellSize(float size); /// Set cell height. void SetCellHeight(float height); /// Set navigation agent height. void SetAgentHeight(float height); /// Set navigation agent radius. void SetAgentRadius(float radius); /// Set navigation agent max vertical climb. void SetAgentMaxClimb(float maxClimb); /// Set navigation agent max slope. void SetAgentMaxSlope(float maxSlope); /// Set region minimum size. void SetRegionMinSize(float size); /// Set region merge size. void SetRegionMergeSize(float size); /// Set edge max length. void SetEdgeMaxLength(float length); /// Set edge max error. void SetEdgeMaxError(float error); /// Set detail sampling distance. void SetDetailSampleDistance(float distance); /// Set detail sampling maximum error. void SetDetailSampleMaxError(float error); /// Set padding of the navigation mesh bounding box. Having enough padding allows to add geometry on the extremities of the navigation mesh when doing partial rebuilds. void SetPadding(const Vector3& padding); /// Rebuild the navigation mesh. Return true if successful. bool Build(); /// Rebuild part of the navigation mesh contained by the world-space bounding box. Return true if successful. bool Build(const BoundingBox& boundingBox); /// Find a path between world space points. Return non-empty list of points if successful. Extents specifies how far off the navigation mesh the points can be. void FindPath(PODVector& dest, const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE); /// Return a random point on the navigation mesh. Vector3 GetRandomPoint(); /// Return a random point on the navigation mesh within a circle. The circle radius is only a guideline and in practice the returned point may be further away. Vector3 GetRandomPointInCircle(const Vector3& center, float radius, const Vector3& extents = Vector3::ONE); /// Return distance to wall from a point. Maximum search radius must be specified. float GetDistanceToWall(const Vector3& point, float radius, const Vector3& extents = Vector3::ONE); /// Perform a walkability raycast on the navigation mesh between start and end and return the point where a wall was hit, or the end point if no walls. Vector3 Raycast(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE); /// Return tile size. int GetTileSize() const; /// Return cell size. float GetCellSize() const; /// Return cell height. float GetCellHeight() const; /// Return navigation agent height. float GetAgentHeight() const; /// Return navigation agent radius. float GetAgentRadius() const; /// Return navigation agent max vertical climb. float GetAgentMaxClimb() const; /// Return navigation agent max slope. float GetAgentMaxSlope() const; /// Return region minimum size. float GetRegionMinSize() const; /// Return region merge size. float GetRegionMergeSize() const; /// Return edge max length. float GetEdgeMaxLength() const; /// Return edge max error. float GetEdgeMaxError() const; /// Return detail sampling distance. float GetDetailSampleDistance() const; /// Return detail sampling maximum error. float GetDetailSampleMaxError() const; /// Return navigation mesh bounding box padding. const Vector3& GetPadding() const; /// Return whether has been initialized with valid navigation data. bool IsInitialized() const; /// Return local space bounding box of the navigation mesh. const BoundingBox& GetBoundingBox() const; /// Return world space bounding box of the navigation mesh. BoundingBox GetWorldBoundingBox() const; /// Return number of tiles. IntVector2 GetNumTiles() const; };