simvx.core.navigation.path_follower_2d

PathFollower2D: constant-speed waypoint traversal node.

Distinct from :class:NavigationAgent2D, which steers toward a single target position and replans with A*. PathFollower2D consumes a pre-computed sequence of :class:Vec2 waypoints and lerps along the polyline at a fixed linear speed. Useful for scripted enemy patrols, conveyor belts, on-rails camera tracks, projectile splines, and Tower Defence-style creep routes.

Usage::

follower = PathFollower2D(path=[Vec2(0, 0), Vec2(100, 0), Vec2(100, 100)], speed=120)
parent.add_child(follower)
follower.path_finished.connect(lambda: print("arrived"))

Override :attr:loop to make the follower wrap back to the start on completion. Override :attr:auto_rotate to align the node’s rotation with the current segment direction.

Module Contents

Classes

PathFollower2D

Follows a polyline of :class:Vec2 waypoints at constant linear speed.

Data

API

simvx.core.navigation.path_follower_2d.__all__

[‘PathFollower2D’]

class simvx.core.navigation.path_follower_2d.PathFollower2D(path: list[simvx.core.math.types.Vec2] | None = None, speed: float = 100.0, *, loop: bool = False, auto_rotate: bool = False, **kwargs)[source]

Bases: simvx.core.nodes_2d.node2d.Node2D

Follows a polyline of :class:Vec2 waypoints at constant linear speed.

Args: path: Sequence of waypoints in world space. Empty or single-point paths leave the follower idle. speed: Linear units per second along the polyline. loop: When True the follower wraps from the last waypoint back to the first; otherwise it stops and emits path_finished. auto_rotate: When True the node’s rotation tracks the current segment heading (radians, atan2(dy, dx)).

Initialization

speed

‘Property(…)’

loop

‘Property(…)’

auto_rotate

‘Property(…)’

property path: list[simvx.core.math.types.Vec2][source]

Return a copy of the path as Vec2 waypoints.

set_path(waypoints) None[source]

Replace the polyline and snap the follower to the first waypoint.

property progress: float[source]

Fractional progress along the path in [0.0, 1.0].

property is_finished: bool[source]

True when a non-looping path has reached its final waypoint.

reset() None[source]

Restart from the first waypoint without rebuilding the polyline.

on_process(dt: float)[source]
position

‘_SpatialVecProperty(…)’

rotation

‘Property(…)’

scale

‘_SpatialVecProperty(…)’

z_index

‘Property(…)’

z_as_relative

‘Property(…)’

render_layer

‘Property(…)’

set_render_layer(index: int, enabled: bool = True) None
is_on_render_layer(index: int) bool
property absolute_z_index: int
property rotation_degrees: float
property world_position: simvx.core.math.types.Vec2
property world_rotation: float
property world_scale: simvx.core.math.types.Vec2
property world_transform: tuple[simvx.core.math.types.Vec2, simvx.core.math.types.Vec2, float]
property forward: simvx.core.math.types.Vec2
property right: simvx.core.math.types.Vec2
translate(offset: tuple[float, float] | numpy.ndarray)
rotate(radians: float)
rotate_deg(degrees: float)
look_at(target: tuple[float, float] | numpy.ndarray)
transform_points(points: list[simvx.core.math.types.Vec2]) list[simvx.core.math.types.Vec2]
draw_polygon(renderer, points: list[simvx.core.math.types.Vec2], closed=True, colour=None)
wrap_screen(margin: float = 20)
strict_errors: ClassVar[bool]

True

script_error_raised

‘Signal(…)’

classmethod __init_subclass__(**kwargs)
property name: str
property process_mode: simvx.core.descriptors.ProcessMode
property visible: bool
reset_error() None
add_child(node: simvx.core.node.Node) simvx.core.node.Node
remove_child(node: simvx.core.node.Node)
reparent(new_parent: simvx.core.node.Node)
get_node(path: str) simvx.core.node.Node
find_child(name: str, recursive: bool = False) simvx.core.node.Node | None
find(target: type | str, recursive: bool = True) simvx.core.node.Node | None
find_all(node_type: type, recursive: bool = True) list
walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]
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_physics_process(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)
clear_children()
destroy()
property app
property tree: simvx.core.scene_tree.SceneTree
__getitem__(key: str)
classmethod get_properties() dict[str, simvx.core.descriptors.Property]
__repr__()