Skip to content

Commit

Permalink
Merge branch 'main' into feat/offchain-contract-marketplace-update
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo authored Dec 4, 2024
2 parents 169bceb + d146838 commit 87a0cc8
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 21 deletions.
4 changes: 4 additions & 0 deletions content/creator/scene-editor/smart-items/combine-with-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Add your custom code in the `index.ts` file under `/src`, inside the `main()` fu

If you have a preview window open running your scene, whenever you change the code in your files and save, the scene reloads automatically with your changes.

{{< hint warning >}}
**📔 Note**: If you have VS Code installed but the **CODE** button doesn't open it, it may be that VS Code is not properly configured on your machine to open via the command line. In most cases, this is care of as part of the default installation, but in case it's not, see [these instructions from VS](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line) to enable VS Code from the command line.
{{< /hint >}}

## Reference an item

When using the Scene Editor and adding entities by dragging them into the canvas, each entity has a unique name. Use the `engine.getEntityOrNullByName()` function to reference one of these entities from your code. Pass the entity's name as a string, as written on the scene's entity tree view in the Scene Editor.
Expand Down
6 changes: 5 additions & 1 deletion content/creator/scene-editor/smart-items/play-videos.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ You can configure the volume of the video's sounds. Note that the audio from the
You can also configure the video to either loop or play once.

{{< hint warning >}}
**📔 Note**: Avoid playing more than one video at any given time in your scene, because it can severely impact performance for players. Always stop other videos before playing a second video.
**📔 Note**: If too many videos are playing at the same time in your scene, some will be paused by the engine. The priority is determined based on proximity to the player, direction of the camera and size of the screen. The maximum amount of simultaneous videos depends on the player's quality settings.

- Low: 1
- Medium: 5
- High: 10

We also recommend starting to play the video when the player is near or performs an action to do that. Starting to play a video when your scene is loaded far in the horizon will unnecessarily affect performance while players visit neighboring scenes.
{{< /hint >}}
Expand Down
28 changes: 14 additions & 14 deletions content/creator/sdk7/interactivity/npc-avatars.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,26 @@ Transform.create(myAvatar, {

## Copy wearables from player

The following snippet creates an NPC avatar that uses the same wearables that the player currently has on. This could be used in a scene as a manequin, to show off a particular wearable or emote combined with the player's current outfit.
The following snippet changes the wearables and other characteristics of an NPC avatar to match those that the player currently has on. This could be used in a scene as a manequin, to show off a particular wearable or emote combined with the player's current outfit.

```ts
import { getPlayer } from '@dcl/sdk/src/players'

export function main() {
let userData = getPlayer()
console.log(userData)

if (!userData || !userData.wearables) return
export function swapAvatar(avatar: Entity) {

const myAvatar = engine.addEntity()
AvatarShape.create(myAvatar, {
id: 'Manequin',
emotes: [],
wearables: userData.wearables,
})
let userData = getPlayer()
console.log(userData)

Transform.create(myAvatar, {
position: Vector3.create(4, 0.25, 5),
})
if (!userData || !userData.wearables) return

const mutableAvatar = AvatarShape.getMutable(avatar)

mutableAvatar.wearables = userData.wearables
mutableAvatar.bodyShape = userData.avatar?.bodyShapeUrn
mutableAvatar.eyeColor = userData.avatar?.eyesColor
mutableAvatar.skinColor = userData.avatar?.skinColor
mutableAvatar.hairColor = userData.avatar?.hairColor

}
```
20 changes: 15 additions & 5 deletions content/creator/sdk7/media/video-playing.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ In all cases, you'll need:
- A [material]({{< ref "/content/creator/sdk7/3d-essentials/materials.md" >}}) with a A `VideoTexture` assigned to its texture
- A `VideoPlayer` component to control the state of the video.

{{< hint warning >}}
**📔 Note**: Keep in mind that streaming video demands a significant effort from the player's machine. For this reason, we recommend never having more than one video stream displayed at a time per scene. Videos are also not played if the player is standing on a different scene. Also avoid streaming videos that are in very high resolution, don't use anything above _HD_.
## Performance considerations

It's also ideal to play videos on Basic (unlit) materials, to reduce the performance load.
{{< /hint >}}
Keep in mind that streaming video demands a significant effort from the player's machine. It's recommended to avoid playing more than one video at a time.

If too many videos are playing at the same time in your scene, some will be paused by the engine. The priority is determined based on proximity to the player, direction of the camera and size of the screen. The maximum amount of simultaneous videos depends on the player's quality settings.

- Low: 1
- Medium: 5
- High: 10

We also recommend starting to play the video when the player is near or performs an action to do that. Starting to play a video when your scene is loaded far in the horizon will unnecessarily affect performance while players visit neighboring scenes.

Also avoid streaming videos that are in very high resolution, don't use anything above _HD_.

It's also ideal to play videos on Basic (unlit) materials, to reduce the performance load, as is the case on all of the example snippets below.

## Show a video

Expand Down Expand Up @@ -149,7 +159,7 @@ Material.setBasicMaterial(screen, {
})
```

If you instead want to project a video onto a PBR material, keep in mind that the default properties make the video look rather opaque. You can enhance that by altering other properties of the material. Here are some recommended settings for the video to stand out more:
It's usually recommended to play videos on Basic unlit materials, as this is better for performance, but if you instead want to project a video onto a PBR material, keep in mind that the default properties make the video look rather opaque. You can enhance that by altering other properties of the material. Here are some recommended settings for the video to stand out more:

```ts
Material.setPbrMaterial(screen, {
Expand Down
2 changes: 1 addition & 1 deletion content/player/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ url: /player
<div class="dcl section medium">
<p>Find help about the various topics in each of these sections</p>
<div class="section-cards-container">
<a href="/player/general/about">
<a href="/player/FAQs/decentraland-101/">
<div class="section-card" style="background: linear-gradient(212.97deg, rgb(235, 73, 90) 0%, rgb(212, 83, 223) 100%);">
<img class="section-card-img" src="https://cdn.decentraland.org/@dcl/docs-site/1.0.0-3144676401.commit-a407e4c/player-world.png">
<div class="section-card-info">
Expand Down

0 comments on commit 87a0cc8

Please sign in to comment.