January 7, 2025
A neat way to write your code is to subscribe to events, and running a function any time that event happens.
A number of Event listeners come predefined as part of the SDK, but you can also use the onChange() method on any component to achieve the same. This also works with any Custom Component that you defined, without needing any extra work.
For example, the following function checks the AvatarEquippedData component on the player entity, and runs a function if the player change any of their equipped wearables or emotes.
...
December 16, 2024
The transactions-server is a proxy server that relays transactions to Gelato . It receives a signed transaction from the client that it’s in turn sent to the appropiate network behind the scenes. This allows the server’s owner to facilitate it’s users with costless transactions
The transaction server is used to help with the UX of using multiple networks and to prevent them from switching network providers on the fly. The users can stay connected to Ethereum and interact with Polygon by only signing transactions The Decentraland DAO has set up a server used by our dapps, covering the cost up to a certain limit with a few restrictions .
...
September 9, 2024
As a creator, you can have full control over the player’s camera. By default, players are free to chose between a 1st or 3rd person camera mode while exploring your scene, but you can impose a different camera modality.
Virtual cameras can be static, they can rotate to always look at the player or some other entity, or they can be attached to the player or some other entity so that they’re always accompanying.
...
June 19, 2023
Get Decentraland Time # Decentraland follows a day/night cycle that takes 2 hours to be completed, so there are 12 full cycles every day. Players can also change the settings to experience a specific fixed time of day, for example to always see Decentraland with a 10pm night sky. For this reason, Decentraland time may vary from one player to another.
Use getWorldTime() to fetch the time of day that the player is experiencing inside Decentraland.
...
February 27, 2018
Raycasting is a fundamental tool in game development. With raycasting, you can trace an imaginary line in space, and query if any entities are intersected by that line. This is useful for calculating lines of sight, trajectories of bullets, pathfinding algorithms and many other applications.
When a player pushes the pointer button, or the primary or secondary button, a ray is traced from the player’s position in the direction they are looking, see button events for more details about this.
...
February 22, 2018
❗Warning: This is a legacy page covering functionality with the old SDK version 6. See the latest version of this topic here . Track player position and rotation # The Camera object exposes information about the player’s point of view in your scene.
Camera.instance.position returns a 3D vector with the coordinates of the avatar’s center, relative to the scene. When the player is on the ground, the height of this point is approximately 1.
...
February 22, 2018
Player position and rotation # Use the PlayerEntity and the CameraEntity to know the player’s position and rotation, by checking their Transform components.
function getPlayerPosition() { if (!Transform.has(engine.PlayerEntity)) return if (!Transform.has(engine.CameraEntity)) return //player position const playerPos = Transform.get(engine.PlayerEntity).position //player rotation const playerRot = Transform.get(engine.PlayerEntity).rotation //camera position const CameraPos = Transform.get(engine.CameraEntity).position //camera rotation const CameraRot = Transform.get(engine.CameraEntity).rotation console.log('playerPos: ', playerPos) console.log('playerRot: ', playerRot) console.log('cameraPos: ', CameraPos) console.log('cameraRot: ', CameraRot) } engine.
...
February 13, 2018
❗Warning: This is a legacy page covering functionality with the old SDK version 6. See the latest version of this topic here . 3D models in .glTF and .glb format can include as many animations as you want in them. Animations tell the mesh how to move, by specifying a series of keyframes that are laid out over time, the mesh then blends from one pose to the other to simulate continuous movement.
...
April 16, 2020
❗Warning: This is a legacy page covering functionality with the old SDK version 6. See the latest version of this topic here . You can add links from your scene out to other content, either to other scenes or to external websites.
Teleports # To teleport a player to another scene, call the following function, indicating the coordinates that you want players to teleport to.
teleportTo('-51,1') Players are presented a confirmation screen before they are teleported, this screen displays information from the destination scene’s scene.
...
April 16, 2020
You can add links from your scene out to other content, either to other scenes or to external websites.
Use the Scene Editor # The easiest way to add an external link or a teleport is to use the Scene Editor . Use the Teleport Smart Item to add teleport to another scene in Genesis City, or use any of the Social Links smart items to add links to external sites.
...