猫史档案馆


谁能给我个代码是关于碰到终点时,就能开启飞行 谢谢🙏

用户:彩虹字转换器彩虹字转换器查看:2 回复:5 评论:2 创建时间:2022-06-16T17:00:08


谁能给我个代码是关于碰到终点时,就能开启飞行

谢谢🙏


回复

上一页1 页 / 共 1下一页
145a145a

终点是方块还是模型还是区域还是边界还是向量,这个很重要

点赞0


评论


_function__function_

需要看你的个人需求:

如果是模型的话:

world.onEntityContact(({ entity, other }) => {
    if (entity.id == '奖杯' && other.isPlayer) {//''种填入模型id
        other.player.canFly = true
    }
})

如果是区域的话:

const area = world.addZone({
    selector: 'player',
    bounds: {
        lo: [,  , ],//自己填区域
        hi: [,  , ],
    },
})
area.onEnter(({ entity }) => {
      entity.player.canFly = true
});

如果是方块的话:

world.onVoxelContact(({ entity, voxel }) => {
    if (voxel == voxels.id('')) {//方块名称自己填入
        entity.player.canFly = true
    }
});

点赞0


评论


_function__function_

我写的已经很全了,希望对你有帮助))

点赞1


评论


彩虹字转换器彩虹字转换器

console.clear() var door = world.querySelector('#高级传送门') //名称需与模型的名称保持一致door.enableInteract = true door.interactRadius = 2 door.interactHint = '传送到观众区' door.onInteract(({ entity }) => { entity.position.set(64,103,64) })

点赞0


评论


彩虹字转换器彩虹字转换器

world.onVoxelContact(({ entity, voxel }) => {
    if (voxel == voxels.id('')) {//方块名称自己填入
        entity.player.canFly = true
    }
});

点赞0


评论