用户:
流浪月球查看:417 回复:4 评论:4 创建时间:2020-07-25T15:21:45
以下是:当玩家进入某个区域就会穿上装备
const area = world.addTrigger({
selector: 'player',
bounds: {
lo: [80, 0, 3],
hi: [80, 6, 5],
},
})
// 需要用 onEnter() 和 onLeave() 触发事件
area.onEnter(({ entity }) => {
world.say('正在通过安检');
});
area.onLeave(({ entity }) => {
// 有玩家离开区域
sleep(5000);
world.say('通过安检');
entity.player.addWearable({
bodyPart: Box3BodyPart.TORSO,//装备穿戴的位置在身上
mesh: 'mesh/宇航背包.vb',//装备是一个叫做“黄喵包”的模型
orientation: new Box3Quaternion(0, 1, 0, 0).rotateY(Math.PI/2),//将模型沿着Y轴旋转90度
scale: new Box3Vector3(1, 1, 1),//模型大小长宽高都缩小0.5倍
offset: new Box3Vector3(0, 0.1, -0.45),//装备的位置,向人背后偏移一些
});
entity.player.addWearable({
bodyPart: Box3BodyPart.HEAD,//装备穿戴的位置在身上
mesh: 'mesh/头盔.vb',//装备是一个叫做“黄喵包”的模型
orientation: new Box3Quaternion(0, 1, 0, 0).rotateY(Math.PI/2),//将模型沿着Y轴旋转90度
scale: new Box3Vector3(0.75 ,0.75, 0.75),//模型大小长宽高都缩小0.5倍
offset: new Box3Vector3(0, 0.5, -0.1),//装备的位置,向人背后偏移一些
});
entity.player.addWearable({
bodyPart: Box3BodyPart.TORSO,//装备穿戴的位置在身上
mesh: 'mesh/宇航服.vb',//装备是一个叫做“黄喵包”的模型
orientation: new Box3Quaternion(0, 1, 0, 0).rotateY(Math.PI/2),//将模型沿着Y轴旋转90度
scale: new Box3Vector3(0.9, 0.9, 0.9),//模型大小长宽高都缩小0.5倍
offset: new Box3Vector3(0, 0, 0),//装备的位置,向人背后偏移一些
});
});
流浪月球dd
点赞0
评论
能来我地图帮我写代码吗?链接:https://box3create.codemao.cn/games/2a61f4e3bda7729912da?p=aYRA喵KwB5Z4xtPxZR%2FfrMMMp%2FDsq1%2BErbdw3uUbwHA7fUuWy4LgVndWVzdA%3D%3D