simvx.core.navigation3d.nodes

Navigation3D node types: Region (holds a mesh), Agent (path-follower), Obstacle (dynamic).

Module Contents

Classes

NavigationRegion3D

Node that holds a NavigationMesh3D and registers it with the server.

NavigationAgent3D

3D pathfinding agent that computes a steering velocity along a navigation mesh path.

NavigationObstacle3D

Dynamic obstacle that affects navigation agent avoidance.

Data

log

API

simvx.core.navigation3d.nodes.log

‘getLogger(…)’

class simvx.core.navigation3d.nodes.NavigationRegion3D(navigation_mesh: simvx.core.navigation3d.mesh.NavigationMesh3D | None = None, **kwargs)[source]

Bases: simvx.core.nodes_3d.node3d.Node3D

Node that holds a NavigationMesh3D and registers it with the server.

Attach a NavigationMesh3D to this node and add it to the scene tree to make its walkable surface available for pathfinding.

Initialization

enabled

‘Property(…)’

on_enter_tree() None[source]
on_exit_tree() None[source]
position

‘_SpatialVecProperty(…)’

rotation

‘Property(…)’

scale

‘_SpatialVecProperty(…)’

render_layer

‘Property(…)’

property rotation_degrees: simvx.core.math.types.Vec3
property world_position: simvx.core.math.types.Vec3
property world_rotation: simvx.core.math.types.Quat
property world_scale: simvx.core.math.types.Vec3
property forward: simvx.core.math.types.Vec3
property right: simvx.core.math.types.Vec3
property up: simvx.core.math.types.Vec3
translate(offset: tuple[float, float, float] | numpy.ndarray)
translate_global(offset: tuple[float, float, float] | numpy.ndarray)
rotate(axis: tuple[float, float, float] | numpy.ndarray, angle: float)
rotate_x(angle: float)
rotate_y(angle: float)
rotate_z(angle: float)
look_at(target: tuple[float, float, float] | numpy.ndarray, up=None)
face_along(forward: tuple[float, float, float] | numpy.ndarray, up: tuple[float, float, float] | numpy.ndarray | None = None) None
set_render_layer(index: int, enabled: bool = True) None
is_on_render_layer(index: int) bool
wrap_bounds(bounds: tuple[float, float, float] | numpy.ndarray, margin: float = 1.0)
strict_errors: ClassVar[bool]

True

dev_checks: ClassVar[bool]

None

script_error_raised

‘Signal(…)’

dynamic: bool

False

visible

‘Property(…)’

update_mode

‘Property(…)’

__properties__: ClassVar[dict[str, simvx.core.descriptors.Property]]

None

classmethod __init_subclass__(**kwargs)
property name: str
property visible_in_tree: bool
reset_error() None
add_child(node: simvx.core.node.T) simvx.core.node.T
remove_child(node: simvx.core.node.Node) None
reparent(new_parent: simvx.core.node.Node)
node_at(path, default=_NO_DEFAULT)
find(target, *, direct: bool = False)
find_all(target, *, direct: bool = False)
expect(target, *, direct: bool = False)
ancestor(target)
walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]
property path: str
property is_scene_root: bool
add_to_group(group: str)
remove_from_group(group: str)
is_in_group(group: str) bool
on_ready() None
on_update(dt: float) None
on_fixed_update(dt: float) None
on_draw(renderer) None
on_picked(event: simvx.core.events.InputEvent) None
on_unhandled_input(event: simvx.core.events.TreeInputEvent) None
start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle
stop_coroutine(gen_or_handle)
queue_redraw() None
property render_dirty: bool
clear_children()
destroy()
property destroying: bool
call_deferred(method: collections.abc.Callable[..., Any], *args: Any) None
property app
property tree: simvx.core.scene_tree.SceneTree
property physics
property physics_2d
__getitem__(key: str)
classmethod get_properties() dict[str, simvx.core.descriptors.Property]
__repr__()
class simvx.core.navigation3d.nodes.NavigationAgent3D(**kwargs)[source]

Bases: simvx.core.nodes_3d.node3d.Node3D

3D pathfinding agent that computes a steering velocity along a navigation mesh path.

The agent moves nothing by itself. Setting target_position paths across the registered navigation regions, and each physics frame the agent advances its waypoint cursor and writes a steering velocity (waypoint following plus obstacle avoidance) into velocity. Applying that velocity is the caller’s job.

Attach the agent as a child of the Node3D you want to move, so that it shares that node’s world position, then move the parent by velocity in the parent’s fixed update::

self.agent = self.add_child(NavigationAgent3D(max_speed=8.0))
self.agent.target_position = Vec3(50, 0, 50)

def on_fixed_update(self, dt):
    self.position = self.position + self.agent.velocity * dt

For a CharacterBody3D parent, hand the steering to the character instead so collisions are resolved. Take only the horizontal components, so whatever the character is doing vertically (gravity, a jump) survives, and build a new vector rather than assigning the agent’s own, which would otherwise be shared and drift as the character integrates::

def on_fixed_update(self, dt):
    steering = self.agent.velocity
    self.velocity = Vec3(steering.x, self.velocity.y, steering.z)
    self.move_and_slide(dt)

Emits navigation_finished when the target is reached. stop() cancels the current order without emitting it.

Initialization

target_desired_distance

‘Property(…)’

path_desired_distance

‘Property(…)’

max_speed

‘Property(…)’

avoidance_radius

‘Property(…)’

property target_position: simvx.core.math.types.Vec3[source]
stop() None[source]

Cancel the current navigation order and leave the agent inert.

Clears the path, zeroes velocity and keeps the agent still on every following physics frame until a new target_position is assigned. Deliberately asymmetric with arrival: navigation_finished is NOT emitted, because the target was not reached. Listeners that need to know about cancellation should observe the call site that cancels.

is_navigation_finished() bool[source]

Check if the agent has reached its target, was stopped, or has no path.

property remaining_path_points: int[source]

Number of waypoints ahead of the agent on its current path.

property remaining_path_length: float[source]

Total distance along the path from the agent’s current position to the final waypoint.

Sums the straight-line distance from the agent to the next waypoint plus each remaining segment. Returns 0.0 when the path is empty or fully consumed.

get_next_path_position() simvx.core.math.types.Vec3[source]

Get the next waypoint position the agent is heading toward.

Returns: Next waypoint, or current position if path is empty.

on_fixed_update(dt: float) None[source]

Advance along the path, computing steering velocity.

position

‘_SpatialVecProperty(…)’

rotation

‘Property(…)’

scale

‘_SpatialVecProperty(…)’

render_layer

‘Property(…)’

property rotation_degrees: simvx.core.math.types.Vec3
property world_position: simvx.core.math.types.Vec3
property world_rotation: simvx.core.math.types.Quat
property world_scale: simvx.core.math.types.Vec3
property forward: simvx.core.math.types.Vec3
property right: simvx.core.math.types.Vec3
property up: simvx.core.math.types.Vec3
translate(offset: tuple[float, float, float] | numpy.ndarray)
translate_global(offset: tuple[float, float, float] | numpy.ndarray)
rotate(axis: tuple[float, float, float] | numpy.ndarray, angle: float)
rotate_x(angle: float)
rotate_y(angle: float)
rotate_z(angle: float)
look_at(target: tuple[float, float, float] | numpy.ndarray, up=None)
face_along(forward: tuple[float, float, float] | numpy.ndarray, up: tuple[float, float, float] | numpy.ndarray | None = None) None
set_render_layer(index: int, enabled: bool = True) None
is_on_render_layer(index: int) bool
wrap_bounds(bounds: tuple[float, float, float] | numpy.ndarray, margin: float = 1.0)
strict_errors: ClassVar[bool]

True

dev_checks: ClassVar[bool]

None

script_error_raised

‘Signal(…)’

dynamic: bool

False

visible

‘Property(…)’

update_mode

‘Property(…)’

__properties__: ClassVar[dict[str, simvx.core.descriptors.Property]]

None

classmethod __init_subclass__(**kwargs)
property name: str
property visible_in_tree: bool
reset_error() None
add_child(node: simvx.core.node.T) simvx.core.node.T
remove_child(node: simvx.core.node.Node) None
reparent(new_parent: simvx.core.node.Node)
node_at(path, default=_NO_DEFAULT)
find(target, *, direct: bool = False)
find_all(target, *, direct: bool = False)
expect(target, *, direct: bool = False)
ancestor(target)
walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]
property path: str
property is_scene_root: bool
add_to_group(group: str)
remove_from_group(group: str)
is_in_group(group: str) bool
on_ready() None
on_enter_tree() None
on_exit_tree() None
on_update(dt: float) None
on_draw(renderer) None
on_picked(event: simvx.core.events.InputEvent) None
on_unhandled_input(event: simvx.core.events.TreeInputEvent) None
start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle
stop_coroutine(gen_or_handle)
queue_redraw() None
property render_dirty: bool
clear_children()
destroy()
property destroying: bool
call_deferred(method: collections.abc.Callable[..., Any], *args: Any) None
property app
property tree: simvx.core.scene_tree.SceneTree
property physics
property physics_2d
__getitem__(key: str)
classmethod get_properties() dict[str, simvx.core.descriptors.Property]
__repr__()
class simvx.core.navigation3d.nodes.NavigationObstacle3D(**kwargs)[source]

Bases: simvx.core.nodes_3d.node3d.Node3D

Dynamic obstacle that affects navigation agent avoidance.

Place in the scene tree to create areas that agents will steer around. Does not carve the navmesh: instead, agents detect obstacles at runtime and adjust their velocity to avoid collisions.

Initialization

radius

‘Property(…)’

height

‘Property(…)’

on_enter_tree() None[source]
on_exit_tree() None[source]
position

‘_SpatialVecProperty(…)’

rotation

‘Property(…)’

scale

‘_SpatialVecProperty(…)’

render_layer

‘Property(…)’

property rotation_degrees: simvx.core.math.types.Vec3
property world_position: simvx.core.math.types.Vec3
property world_rotation: simvx.core.math.types.Quat
property world_scale: simvx.core.math.types.Vec3
property forward: simvx.core.math.types.Vec3
property right: simvx.core.math.types.Vec3
property up: simvx.core.math.types.Vec3
translate(offset: tuple[float, float, float] | numpy.ndarray)
translate_global(offset: tuple[float, float, float] | numpy.ndarray)
rotate(axis: tuple[float, float, float] | numpy.ndarray, angle: float)
rotate_x(angle: float)
rotate_y(angle: float)
rotate_z(angle: float)
look_at(target: tuple[float, float, float] | numpy.ndarray, up=None)
face_along(forward: tuple[float, float, float] | numpy.ndarray, up: tuple[float, float, float] | numpy.ndarray | None = None) None
set_render_layer(index: int, enabled: bool = True) None
is_on_render_layer(index: int) bool
wrap_bounds(bounds: tuple[float, float, float] | numpy.ndarray, margin: float = 1.0)
strict_errors: ClassVar[bool]

True

dev_checks: ClassVar[bool]

None

script_error_raised

‘Signal(…)’

dynamic: bool

False

visible

‘Property(…)’

update_mode

‘Property(…)’

__properties__: ClassVar[dict[str, simvx.core.descriptors.Property]]

None

classmethod __init_subclass__(**kwargs)
property name: str
property visible_in_tree: bool
reset_error() None
add_child(node: simvx.core.node.T) simvx.core.node.T
remove_child(node: simvx.core.node.Node) None
reparent(new_parent: simvx.core.node.Node)
node_at(path, default=_NO_DEFAULT)
find(target, *, direct: bool = False)
find_all(target, *, direct: bool = False)
expect(target, *, direct: bool = False)
ancestor(target)
walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]
property path: str
property is_scene_root: bool
add_to_group(group: str)
remove_from_group(group: str)
is_in_group(group: str) bool
on_ready() None
on_update(dt: float) None
on_fixed_update(dt: float) None
on_draw(renderer) None
on_picked(event: simvx.core.events.InputEvent) None
on_unhandled_input(event: simvx.core.events.TreeInputEvent) None
start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle
stop_coroutine(gen_or_handle)
queue_redraw() None
property render_dirty: bool
clear_children()
destroy()
property destroying: bool
call_deferred(method: collections.abc.Callable[..., Any], *args: Any) None
property app
property tree: simvx.core.scene_tree.SceneTree
property physics
property physics_2d
__getitem__(key: str)
classmethod get_properties() dict[str, simvx.core.descriptors.Property]
__repr__()