Feature: Implement and test clear target functionality for player start actions

This commit is contained in:
2026-04-27 15:55:36 +02:00
parent d09c550ffe
commit 715f819f76
8 changed files with 386 additions and 132 deletions

View File

@@ -660,6 +660,8 @@ function getPlayerStartInputActionLabel(
return "Crouch";
case "interact":
return "Interact";
case "clearTarget":
return "Clear Target";
case "pauseTime":
return "Pause";
}

View File

@@ -34,8 +34,10 @@ export const PLAYER_START_TARGETING_SETTINGS_SCENE_DOCUMENT_VERSION =
83 as const;
export const PLAYER_START_INTERACT_BINDINGS_SCENE_DOCUMENT_VERSION =
82 as const;
export const PLAYER_START_INTERACTION_ANGLE_SCENE_DOCUMENT_VERSION = 81 as const;
export const PLAYER_START_INTERACTION_REACH_SCENE_DOCUMENT_VERSION = 80 as const;
export const PLAYER_START_INTERACTION_ANGLE_SCENE_DOCUMENT_VERSION =
81 as const;
export const PLAYER_START_INTERACTION_REACH_SCENE_DOCUMENT_VERSION =
80 as const;
export const SHADER_SKY_AURORA_SCENE_DOCUMENT_VERSION = 79 as const;
export const CAMERA_RIG_MAPPED_RAIL_SCENE_DOCUMENT_VERSION = 78 as const;
export const CAMERA_RIG_CONTROL_SURFACE_SCENE_DOCUMENT_VERSION = 77 as const;

View File

@@ -136,8 +136,11 @@ import {
type AdvancedRenderingSettings
} from "../document/world-settings";
import {
createPlayerStartInputBindings,
DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH,
DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES,
DEFAULT_PLAYER_START_INTERACTION_REACH_METERS,
DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET,
getNpcColliderHeight,
getPlayerStartMouseBindingCodeForButton,
isPlayerStartMouseBindingCode
@@ -216,6 +219,7 @@ import {
} from "./runtime-scene-build";
import {
resolveDefaultTargetCycleInput,
resolvePlayerStartClearTargetInput,
resolvePlayerStartInteractInput,
resolvePlayerStartLookInput,
resolvePlayerStartPauseInput
@@ -787,6 +791,7 @@ export class RuntimeHost {
private activeRuntimeTargetOcclusionSeconds = 0;
private runtimeTargetSwitchInputHeld = false;
private previousTargetCycleInputActive = false;
private previousClearTargetInputActive = false;
private activeCameraRigOverrideEntityId: string | null = null;
private activeCameraSourceKey: RuntimeCameraSourceKey | null = null;
private activeRuntimeCameraRig: RuntimeCameraRig | null = null;
@@ -1095,6 +1100,7 @@ export class RuntimeHost {
this.controlPauseActive = false;
this.dialoguePauseActive = false;
this.previousInteractInputActive = false;
this.previousClearTargetInputActive = false;
this.previousPauseInputActive = false;
this.cameraRigLookDragging = false;
this.cameraRigLookYawRadians = 0;
@@ -1337,6 +1343,7 @@ export class RuntimeHost {
this.controlPauseActive = false;
this.dialoguePauseActive = false;
this.previousInteractInputActive = false;
this.previousClearTargetInputActive = false;
this.previousPauseInputActive = false;
this.cameraRigLookDragging = false;
this.cameraRigLookYawRadians = 0;
@@ -5009,6 +5016,7 @@ export class RuntimeHost {
this.updateInteractInputState();
this.updatePauseInputState();
this.updateRuntimeTargetingInputState();
this.updateClearTargetInputState();
const simulationDt = this.isRuntimePaused() ? 0 : dt;
const cameraDt = dt;
const previousCameraPose = this.captureCurrentCameraPose();
@@ -5687,6 +5695,7 @@ export class RuntimeHost {
this.activeRuntimeTargetOcclusionSeconds = 0;
this.runtimeTargetSwitchInputHeld = false;
this.previousTargetCycleInputActive = false;
this.previousClearTargetInputActive = false;
this.targetingLuxInitialized = false;
this.targetingLuxFlightState = "hidden";
this.targetingVisualTime = 0;
@@ -6764,6 +6773,7 @@ export class RuntimeHost {
private handleRuntimeBlur = () => {
this.pressedKeys.clear();
this.previousInteractInputActive = false;
this.previousClearTargetInputActive = false;
this.previousPauseInputActive = false;
this.previousTargetCycleInputActive = false;
this.cameraRigLookDragging = false;