Skip to reading
Getting started with PCA3D

interior_sequence

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView PDF page
On this page

R10. Directed-opening helper sources

Code example
            actor.global_position = Vector3(-0.4,0,0.2) if actor_id == "ada" else Vector3(1.2,0,-1.2)
            actor.play_state("idle")
    Runtime.face_character("ada", "elias")
    Runtime.face_character("elias", "ada")
    Runtime.set_gameplay_hud_visible(true)
    Runtime.change_camera("wide")
    # Display guidance without holding the room-entry action queue.
    Runtime.show_message("Click objects to interact. Use the verb bar to Look or Pick Up. Esc opens
        saves and options.", 3.2, false)
    return true

Starts the indoor opening or takes the skip/handoff path when the introduction was skipped.

Code example
func run(_context: Dictionary = {}) -> Variant:
    if bool(Runtime.variables.get("intro_skip_all", false)):
        await Runtime.run_script("intro_handoff")
    else:
        await Runtime.start_cutscene("opening")
    return true

intro_dialogue_orbit#

Supports the slow directed orbit during conversation.

Code example
func run(_context: Dictionary = {}) -> Variant:
    var generation: int = Runtime.runtime_generation
    var actor: Node3D = Runtime.entity_nodes.get("elias")
    if actor == null: return false
    var center: Vector3 = actor.global_position + Vector3(0,1.2,0)
    var offset: Vector3 = Vector3(-1.4,0.60,3.0)
    var seconds: float = 0.0
    while seconds < 7.4 and Runtime.runtime_generation == generation and Runtime.cutscene_runner.running
        and Runtime.active_camera_id == "intro_elias":
        var fraction: float = clampf(seconds/7.4,0,1)
        var eased: float = fraction*fraction*(3.0-2.0*fraction)
        Runtime.set_camera_pose(center + offset.rotated(Vector3.UP,deg_to_rad(55.0)*eased),center,41.0)
        await Runtime.get_tree().process_frame
        seconds += Runtime.get_process_delta_time()
    return true

intro_face_pair#

Keeps Ivo and Elias facing each other during the relevant opening phase.

Code example
func run(_context: Dictionary = {}) -> Variant:
    var generation: int = Runtime.runtime_generation
    var a: AdventureActor = Runtime.entity_nodes.get("ada") as AdventureActor
    var b: AdventureActor = Runtime.entity_nodes.get("elias") as AdventureActor
    if a == null or b == null: return false
    var a_start: float = a.rotation.y
    var b_start: float = b.rotation.y
    var a_end: float = a._local_yaw_for_world_direction(b.global_position-a.global_position)
    var b_end: float = b._local_yaw_for_world_direction(a.global_position-b.global_position)
    var seconds: float = 0.0
    while seconds < 0.75 and Runtime.runtime_generation == generation and
        Runtime.cutscene_runner.running:
        var t: float = clampf(seconds/0.75,0,1)
        t = t*t*(3.0-2.0*t)
        a.rotation.y = lerp_angle(a_start,a_end,t)
        b.rotation.y = lerp_angle(b_start,b_end,t)
        await Runtime.get_tree().process_frame
        seconds += Runtime.get_process_delta_time()
    if Runtime.runtime_generation == generation and Runtime.cutscene_runner.running:
Page 181 of 184Permalink
Go to page