From 2631ba6a002dc6ff5032a7b895942f0c676597b4 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 11 May 2026 21:54:09 +0200 Subject: [PATCH] Add NPC target anchor system to entity instances --- src/entities/entity-instances.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/entities/entity-instances.ts b/src/entities/entity-instances.ts index 077d6ee8..0490df2b 100644 --- a/src/entities/entity-instances.ts +++ b/src/entities/entity-instances.ts @@ -179,11 +179,26 @@ export interface NpcTimeWindowPresence { export type NpcPresence = NpcAlwaysPresence | NpcTimeWindowPresence; +export const NPC_TARGET_ANCHOR_MODES = [ + "center", + "eyeHeight", + "top", + "origin", + "custom" +] as const; +export type NpcTargetAnchorMode = (typeof NPC_TARGET_ANCHOR_MODES)[number]; + +export interface NpcTargetAnchor { + mode: NpcTargetAnchorMode; + offset: Vec3; +} + export interface NpcEntity extends PositionedEntity { kind: "npc"; actorId: string; presence: NpcPresence; targetable: boolean; + targetAnchor: NpcTargetAnchor; yawDegrees: number; scale: Vec3; modelAssetId: string | null; @@ -602,6 +617,12 @@ export const DEFAULT_NPC_MODEL_ASSET_ID: string | null = null; export const DEFAULT_NPC_DIALOGUE_ID: string | null = null; export const DEFAULT_NPC_COLLIDER_MODE: PlayerStartColliderMode = "capsule"; export const DEFAULT_NPC_TARGETABLE = true; +export const DEFAULT_NPC_TARGET_ANCHOR_MODE: NpcTargetAnchorMode = "center"; +export const DEFAULT_NPC_TARGET_ANCHOR_OFFSET: Vec3 = { + x: 0, + y: 0, + z: 0 +}; export const DEFAULT_NPC_TIME_WINDOW_START_HOUR = 9; export const DEFAULT_NPC_TIME_WINDOW_END_HOUR = 17; export const DEFAULT_PLAYER_START_COLLIDER_MODE: PlayerStartColliderMode =