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.
- 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__()ΒΆ