How to use the decentraland-ecs/src.engine.addEntity function in decentraland-ecs

To help you get started, we’ve selected a few decentraland-ecs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentraland / explorer / kernel / public / test-scenes / 135.123.shark-animation / game.ts View on Github external
shark2.addComponent(new OnPointerUp(
  e => {}, {
    button: ActionButton.POINTER,
      hoverText: "OnPointerUp!", distance: 100 }))
engine.addEntity(shark2)

// Add 3D model for scenery
const seaBed = new Entity()
seaBed.addComponent(new GLTFShape('models/Underwater.gltf'))
seaBed.addComponent(
  new Transform({
    position: new Vector3(10, 0, 8),
    scale: new Vector3(0.5, 0.5, 0.5)
  })
)
engine.addEntity(seaBed)
github decentraland / explorer / kernel / public / test-scenes / 0.103.avatar-modifiers / game.ts View on Github external
const SIZE = 4

// HIDE_AVATARS
const hideAvatarsEntity = new Entity()
hideAvatarsEntity.addComponent(new AvatarModifierArea({ area: { box: new Vector3(SIZE, SIZE, SIZE) }, modifiers: [AvatarModifiers.HIDE_AVATARS] }))
hideAvatarsEntity.addComponent(new Transform({ position: new Vector3(5, SIZE / 2, 8) }))
hideAvatarsEntity.addComponent(new TextShape('Invisible'))
hideAvatarsEntity.addComponent(new Billboard(true, true, true))
engine.addEntity(hideAvatarsEntity)

const box1 = new Entity()
const shape1 = new BoxShape()
shape1.withCollisions = false
box1.addComponent(shape1)
box1.addComponent(new Transform({ position: new Vector3(5, 0.125, 8), scale: new Vector3(SIZE, 0.25, SIZE) }))
engine.addEntity(box1)

// DISABLE_PASSPORTS
const disablePassportsEntity = new Entity()
disablePassportsEntity.addComponent(new AvatarModifierArea({ area: { box: new Vector3(SIZE, SIZE, SIZE) }, modifiers: [AvatarModifiers.DISABLE_PASSPORTS] }))
disablePassportsEntity.addComponent(new Transform({ position: new Vector3(11, SIZE / 2, 8) }))
disablePassportsEntity.addComponent(new TextShape('No Passports'))
disablePassportsEntity.addComponent(new Billboard(true, true, true))
engine.addEntity(disablePassportsEntity)

const box2 = new Entity()
const shape2 = new BoxShape()
shape2.withCollisions = false
box2.addComponent(shape2)
box2.addComponent(new Transform({ position: new Vector3(11, 0.125, 8), scale: new Vector3(SIZE, 0.25, SIZE) }))
engine.addEntity(box2)
github decentraland / explorer / public / test-parcels / 142.134.tree-scene / game.ts View on Github external
import { Entity, GLTFShape, engine, Vector3, Transform } from 'decentraland-ecs/src'

const entity = new Entity()
entity.addComponent(new GLTFShape('models/Tree_Scene.glb'))
entity.addComponent(new Transform({ position: new Vector3(8, 0, 8) }))
engine.addEntity(entity)
github decentraland / explorer / kernel / public / test-scenes / -103.102.nft / game.ts View on Github external
import { NFTShape, Entity, engine, Transform, Vector3, Color3 } from 'decentraland-ecs/src'

const entity = new Entity()
const shapeComponent = new NFTShape('ethereum://0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/558536')
entity.addComponent(shapeComponent)
entity.addComponent(
  new Transform({
    position: new Vector3(3, 1.5, 4)
  })
)
engine.addEntity(entity)

const entity2 = new Entity()
const shapeComponent2 = new NFTShape('ethereum://0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/558536', Color3.Green())
entity2.addComponent(shapeComponent2)
entity2.addComponent(
  new Transform({
    position: new Vector3(5, 1.5, 4)
  })
)
engine.addEntity(entity2)