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¶
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.Camera3D3rd-person follow camera with lag-and-spring smoothing.
Properties: target: The :class:
Node3Dto follow.Nonemakes 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 totarget.world_positionwhen 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: WhenTrue(default), the camera’soffsetrotates with the target’s yaw so the camera stays behind a moving target. WhenFalse,offsetis 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.
- fov¶
‘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¶
- 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
- 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¶
- walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]¶
- property path: str¶
- add_to_group(group: str)¶
- remove_from_group(group: str)¶
- is_in_group(group: str) bool¶
- on_ready() 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__()¶