Skip to reading
Getting started with PCA3D

R10. Directed-opening helper sources

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

R10. Directed-opening helper sources

Code example
        ivo.global_position = ivo_start.lerp(ivo_mark, fraction)
        elias.global_position = elias_start.lerp(elias_mark, fraction)
        await Runtime.get_tree().process_frame
        seconds += Runtime.get_process_delta_time()
    if not active(generation): return false
    ivo.global_position = ivo_mark
    elias.global_position = elias_mark
    Runtime.face_character("ada", "elias")
    Runtime.face_character("elias", "ada")
    Runtime.set_character_state("ada", "handshake")
    Runtime.set_character_state("elias", "handshake")
    Runtime.set_meta("clockmaker_handshake_phase", "reach")
    var linked: bool = false
    var released: bool = false
    seconds = 0.0
    while seconds < 3.65 and active(generation):
        if seconds >= 0.95 and not linked and not released:
            var touching: bool = await AttachPointsTouching({"entityId":"ada",
                "point":"right_hand_grip", "targetId":"elias", "targetPoint":"right_hand_grip",
                "tolerance":0.012})
            if touching:
                linked = await AttachPoints({"entityId":"ada", "point":"right_hand_grip",
                    "targetId":"elias", "targetPoint":"right_hand_grip", "alignRotation":false,
                    "suspendMovement":true})
                Runtime.set_meta("clockmaker_handshake_phase", "clasp")
            elif seconds > 1.15:
                released = true
                Runtime.log_message("Handshake contact missed; keeping the authored animation without
                    snapping.")
        if seconds >= 2.5 and not released:
            await DetachObject({"entityId":"ada"})
            released = true
            Runtime.set_meta("clockmaker_handshake_phase", "release")
        await Runtime.get_tree().process_frame
Code example
        seconds += Runtime.get_process_delta_time()
    if Runtime.runtime_generation == generation:
        await DetachObject({"entityId":"ada"})
        Runtime.set_meta("clockmaker_handshake_phase", "finished")
    return linked
Page 183 of 184Permalink
Go to page