diff --git a/ai-sdk-context/sdk7-complete-reference.md b/ai-sdk-context/sdk7-complete-reference.md index ff6c2393..7a10985c 100644 --- a/ai-sdk-context/sdk7-complete-reference.md +++ b/ai-sdk-context/sdk7-complete-reference.md @@ -1367,6 +1367,7 @@ AvatarModifierArea.create(modifierArea, { // Available modifiers AvatarModifierType.AMT_HIDE_AVATARS AvatarModifierType.AMT_DISABLE_PASSPORTS +AvatarModifierType.AMT_HIDE_NAMETAGS // Hides nametags while keeping avatars visible ``` #### Movement Constraints diff --git a/ai-sdk-context/sdk7-examples.mdc b/ai-sdk-context/sdk7-examples.mdc index 22caa618..6d7b0dfb 100644 --- a/ai-sdk-context/sdk7-examples.mdc +++ b/ai-sdk-context/sdk7-examples.mdc @@ -1201,9 +1201,16 @@ import { AvatarModifierArea, AvatarModifierType } from '@dcl/sdk/ecs' AvatarModifierArea.create(entity, { area: Vector3.create(5, 5, 5), // Box size modifiers: [AvatarModifierType.AMT_HIDE_AVATARS], - // Or AMT_DISABLE_PASSPORTS + // Or AMT_DISABLE_PASSPORTS or AMT_HIDE_NAMETAGS excludeIds: ['user-address-1', 'user-address-2'] // Optional: players not affected }) + +// Create an area that hides nametags only (avatars remain visible) +AvatarModifierArea.create(entity, { + area: Vector3.create(5, 5, 5), + modifiers: [AvatarModifierType.AMT_HIDE_NAMETAGS], + excludeIds: [] +}) ``` ### Portable Experiences diff --git a/creator-esp/sdk7/interactivity/avatar-modifiers.md b/creator-esp/sdk7/interactivity/avatar-modifiers.md index 48bc9803..12ddc26c 100644 --- a/creator-esp/sdk7/interactivity/avatar-modifiers.md +++ b/creator-esp/sdk7/interactivity/avatar-modifiers.md @@ -46,6 +46,7 @@ Los modificadores compatibles son: * `AvatarModifierType.AMT_HIDE_AVATARS` * `AvatarModifierType.AMT_DISABLE_PASSPORTS` +* `AvatarModifierType.AMT_HIDE_NAMETAGS` Todos los efectos de un `AvatarModifierArea` solo tienen lugar dentro de la región de su área. Los jugadores vuelven a la normalidad cuando salen del área. @@ -105,6 +106,46 @@ Transform.create(entity, { Esto es especialmente útil en juegos donde accidentalmente abrir esta UI podría interrumpir el flujo del juego, por ejemplo en un juego de disparos multijugador. +### Ocultar etiquetas de nombre + +Cuando un jugador camina hacia un `AvatarModifierArea` que tiene el modificador `AvatarModifierType.AMT_HIDE_NAMETAGS`, la etiqueta de nombre del jugador se oculta mientras el avatar permanece visible. + +```ts +const entity = engine.addEntity() + +AvatarModifierArea.create(entity, { + area: Vector3.create(4, 3, 4), + modifiers: [AvatarModifierType.AMT_HIDE_NAMETAGS], + excludeIds: [] +}) + +Transform.create(entity, { + position: Vector3.create(8, 0, 8), +}) +``` + +Esto es útil para escenarios, presentaciones o escenas con guión donde quieres ocultar las etiquetas de nombre de los jugadores sin ocultar los avatares. Por ejemplo, podrías querer una experiencia visual limpia durante una actuación, donde los avatares son visibles pero los nombres flotantes no distraen a los espectadores. + +También puedes combinar `AMT_HIDE_NAMETAGS` con otros modificadores. Por ejemplo, si usas tanto `AMT_HIDE_AVATARS` como `AMT_HIDE_NAMETAGS` en la misma área, el avatar y la etiqueta de nombre se ocultan. + +```ts +const entity = engine.addEntity() + +AvatarModifierArea.create(entity, { + area: Vector3.create(4, 3, 4), + modifiers: [AvatarModifierType.AMT_HIDE_AVATARS, AvatarModifierType.AMT_HIDE_NAMETAGS], + excludeIds: [] +}) + +Transform.create(entity, { + position: Vector3.create(8, 0, 8), +}) +``` + +{% hint style="info" %} +**💡 Consejo**: La etiqueta de nombre solo se oculta mientras la cabeza o torso del jugador está dentro del área. Si el área es demasiado baja y el jugador hace un doble salto por encima, la etiqueta de nombre reaparecerá brevemente. Haz el área lo suficientemente alta para cubrir el rango de movimiento esperado. +{% endhint %} + ## Modificadores de cámara Normalmente los jugadores son libres de cambiar entre cámara en primera y tercera persona presionando V en el teclado. Usa un `CameraModeArea` para forzar el modo de cámara a 1ra o 3ra persona para todos los jugadores que están dentro de un área específica en tu escena. diff --git a/creator/sdk7/interactivity/player-avatar.md b/creator/sdk7/interactivity/player-avatar.md index 11ebd989..c513a8a8 100644 --- a/creator/sdk7/interactivity/player-avatar.md +++ b/creator/sdk7/interactivity/player-avatar.md @@ -416,6 +416,7 @@ The supported modifiers are: * `AvatarModifierType.AMT_HIDE_AVATARS` * `AvatarModifierType.AMT_DISABLE_PASSPORTS` +* `AvatarModifierType.AMT_HIDE_NAMETAGS` All the effects of an `AvatarModifierArea` only take place within the region of their area. Players return to normal when they walk out of the area. @@ -477,6 +478,46 @@ Transform.create(entity, { This is especially useful in games where accidentally opening this UI could interrupt the flow of a game, for example in a multiplayer shooter game. +### Hide nametags + +When a player walks into an `AvatarModifierArea` that has the `AvatarModifierType.AMT_HIDE_NAMETAGS` modifier, the player's nametag is hidden while the avatar itself remains visible. + +```ts +const entity = engine.addEntity() + +AvatarModifierArea.create(entity, { + area: Vector3.create(4, 3, 4), + modifiers: [AvatarModifierType.AMT_HIDE_NAMETAGS], + excludeIds: [] +}) + +Transform.create(entity, { + position: Vector3.create(8, 0, 8), +}) +``` + +This is useful for stages, presentations, or scripted scenes where you want to suppress player nametags without hiding the avatars themselves. For example, you might want a clean visual experience during a performance, where avatars are visible but the floating names don't distract viewers. + +You can also combine `AMT_HIDE_NAMETAGS` with other modifiers. For example, if you use both `AMT_HIDE_AVATARS` and `AMT_HIDE_NAMETAGS` on the same area, the avatar and the nametag are both hidden. + +```ts +const entity = engine.addEntity() + +AvatarModifierArea.create(entity, { + area: Vector3.create(4, 3, 4), + modifiers: [AvatarModifierType.AMT_HIDE_AVATARS, AvatarModifierType.AMT_HIDE_NAMETAGS], + excludeIds: [] +}) + +Transform.create(entity, { + position: Vector3.create(8, 0, 8), +}) +``` + +{% hint style="info" %} +**💡 Tip**: The nametag is only hidden while the player's head or torso is inside the area. If the area is too short and the player double-jumps above it, the nametag will briefly reappear. Make the area tall enough to cover the expected range of movement. +{% endhint %} + ### Exclude Avatars You can exclude a list of players from being affected by a modifier area by adding their player Ids to an array in the `excludeIds` property of the modifier area.