KX_NavMeshObject
Base class: KX_GameObject
Python interface for using and controlling navigation meshes.
A navigation mesh with a Boolean game property dynamic_navmesh set to True is built in tiles when the
game starts, so obstacles can carve it at runtime. Objects with “Create Obstacle” carve it automatically;
addObstacle adds any other object. Paths may differ slightly from the static navigation mesh.
dynamic
Section titled “dynamic”True when the navigation mesh was built in tiles and obstacles can carve it (read-only).
Type: boolean
version
Section titled “version”Incremented when the navigation mesh is rebuilt or finishes changing because of obstacles (read-only). Paths found with an older version may cross new obstacles.
Type: integer
findPath(start, goal)
Section titled “findPath(start, goal)”Finds the path from start to goal points.
start: the start pointstart: 3D Vectorgoal: the goal pointstart: 3D Vector
Returns: a path as a list of points
Return type: list of points
raycast(start, goal)
Section titled “raycast(start, goal)”Raycast from start to goal points.
start: the start pointstart: 3D Vectorgoal: the goal pointstart: 3D Vector
Returns: the hit factor
Return type: float
draw(mode)
Section titled “draw(mode)”Draws a debug mesh for the navigation mesh. On a dynamic navigation mesh, the obstacle cylinders are drawn in yellow.
mode: the drawing mode (one ofthese constants)mode: integer
Returns: None
rebuild()
Section titled “rebuild()”Rebuild the navigation mesh.
Returns: None
addObstacle(object, radius=0.0)
Section titled “addObstacle(object, radius=0.0)”Makes the object carve every dynamic navigation mesh of its scene, following it when it moves. Calling it again changes the radius. It has no effect on static navigation meshes.
object: the obstacle, in the same scene as the navigation mesh- type:
KX_GameObjector string
- type:
radius: the world radius of the obstacle cylinder, 0.0 uses the object “Create Obstacle” radius or half its bounding box size- type: float
Returns: None
removeObstacle(object)
Section titled “removeObstacle(object)”Stops the object carving the dynamic navigation meshes, including objects with “Create Obstacle”.
object: the obstacle- type:
KX_GameObjector string
- type:
Returns: None
