用户:
彩虹字转换器查看:2 回复:5 评论:2 创建时间:2022-06-16T17:00:08
谁能给我个代码是关于碰到终点时,就能开启飞行
谢谢🙏
_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
评论
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
评论