simvx.core.nodes_3d.chase_cameraΒΆ

ChaseCamera – lag-and-spring 3rd-person follow camera.

Wraps a Camera3D in a smoothed follow rig that tracks a target node’s world position with critically-damped spring dynamics. Surfaced by the HexGL port (~50 LOC of hand-rolled smoothing) and the Q1K3 port (a near-identical pattern). Promoted to engine-level because every 3D port ends up reinventing it.

Usage::

self.player = self.add_child(MeshInstance3D(...))
cam = ChaseCamera(target=self.player, offset=Vec3(0, 3, 6), half_life=0.15)
self.add_child(cam)

The camera positions itself at target.world_position + offset rotated by the target’s heading (so the camera trails behind the target along its local -Z), and looks at target.world_position + look_offset.

Module ContentsΒΆ

ClassesΒΆ

ChaseCamera

3rd-person follow camera with lag-and-spring smoothing.

DataΒΆ

APIΒΆ

simvx.core.nodes_3d.chase_camera.__all__ΒΆ

[β€˜ChaseCamera’]

class simvx.core.nodes_3d.chase_camera.ChaseCamera(target: simvx.core.nodes_3d.node3d.Node3D | None = None, **kwargs)[source]ΒΆ

Bases: simvx.core.nodes_3d.camera.Camera3D

3rd-person follow camera with lag-and-spring smoothing.

Properties: target: The :class:Node3D to follow. None makes the camera stationary (useful while assets load). offset: Camera position relative to the target, in the target’s local frame (X = right, Y = up, Z = behind). look_offset: Optional offset added to target.world_position when computing the look-at point (useful for aiming above / below the target’s pivot). half_life: Smoothing half-life (seconds). 0 = instant snap. Position and look point share the same half-life so the rig stays critically damped. rotate_with_target: When True (default), the camera’s offset rotates with the target’s yaw so the camera stays behind a moving target. When False, offset is treated as a world-space vector: useful for fixed isometric or god-view rigs.

Initialization

offsetΒΆ

β€˜Property(…)’

look_offsetΒΆ

β€˜Property(…)’

half_lifeΒΆ

β€˜Property(…)’

rotate_with_targetΒΆ

β€˜Property(…)’

property target: simvx.core.nodes_3d.node3d.Node3D | None[source]ΒΆ
snap() → None[source]ΒΆ

Teleport the camera to the target’s current rest pose.

Use after a scene transition or warp to avoid the smoother interpolating through walls.

on_enter_tree() → None[source]ΒΆ
on_update(dt: float) → None[source]ΒΆ
projectionΒΆ

β€˜Property(…)’

fovΒΆ

β€˜Property(…)’

ortho_sizeΒΆ

β€˜Property(…)’

nearΒΆ

β€˜Property(…)’

farΒΆ

β€˜Property(…)’

exposureΒΆ

β€˜Property(…)’

cull_maskΒΆ

β€˜Bitmask(…)’

gizmo_colourΒΆ

β€˜Colour(…)’

set_cull_mask_layer(index: int, enabled: bool = True) → NoneΒΆ
is_cull_mask_layer_enabled(index: int) → boolΒΆ
get_gizmo_lines() → list[tuple[simvx.core.math.types.Vec3, simvx.core.math.types.Vec3]]ΒΆ
property view_matrix: numpy.ndarrayΒΆ
projection_matrix(aspect: float = 16 / 9) → numpy.ndarrayΒΆ
ray_at(screen_pos) → simvx.core.math.raycast.RayΒΆ
world_to_screen(point) → simvx.core.math.types.Vec2 | NoneΒΆ
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

dev_warnings: ClassVar[bool]ΒΆ

None

freeze_check_interval: ClassVar[float]ΒΆ

1.0

dynamic: boolΒΆ

False

visibleΒΆ

β€˜Property(…)’

update_modeΒΆ

β€˜Property(…)’

focus_modeΒΆ

β€˜Property(…)’

drag_thresholdΒΆ

β€˜Property(…)’

focus_enteredΒΆ

β€˜Signal(…)’

focus_exitedΒΆ

β€˜Signal(…)’

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

None

classmethod __init_subclass__(**kwargs)ΒΆ
property name: strΒΆ
property visible_in_tree: boolΒΆ
property input_player: simvx.core.input.players.InputPlayerΒΆ
property input_context: simvx.core.input.contexts.InputContext | NoneΒΆ
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_exit_tree() → NoneΒΆ
on_fixed_update(dt: float) → NoneΒΆ
on_draw(canvas) → NoneΒΆ
on_draw_3d(gizmos) → NoneΒΆ
on_picked(event: simvx.core.input.events.PickEvent) → bool | NoneΒΆ
on_gui_input(event: simvx.core.input.events.GuiInputEvent) → bool | NoneΒΆ
start_coroutine(gen: simvx.core.descriptors.Coroutine) → simvx.core.descriptors.CoroutineHandleΒΆ
stop_coroutine(gen_or_handle)ΒΆ
property focused: boolΒΆ
property focus_rect: tuple[float, float, float, float] | NoneΒΆ
drag_threshold_for(pointer_type: simvx.core.input.enums.PointerType | str) → floatΒΆ
grab_focus() → NoneΒΆ
release_focus() → NoneΒΆ
capture_pointer(pointer_id: int | None = None) → NoneΒΆ
release_pointer(pointer_id: int | None = None) → NoneΒΆ
queue_redraw() → NoneΒΆ
property render_dirty: boolΒΆ
clear_children()ΒΆ
destroy()ΒΆ
property destroying: boolΒΆ
property destroyed: boolΒΆ
call_deferred(method: collections.abc.Callable[..., Any], *args: Any) → NoneΒΆ
property appΒΆ
property tree: simvx.core.scene_tree.SceneTreeΒΆ
property viewport_size: simvx.core.math.types.Vec2ΒΆ
property viewport_insets: tuple[float, float, float, float]ΒΆ
property physicsΒΆ
property physics_2dΒΆ
__getitem__(key: str)ΒΆ
classmethod get_properties() → dict[str, simvx.core.descriptors.Property]ΒΆ
__repr__()ΒΆ