用户:
芜湖咸鱼查看:131 回复:77 评论:131 创建时间:2020-03-09T17:50:56
一堆人逼我发帖,我只好发了啊QAQ
首先,请看API:
控制实体的外观 mesh• mesh: string = ""
实体形状数据(mesh)的hash。如果设为空字符串/'',则实体无mesh。 除非实体为玩家,否则设定实体的mesh之后,mesh就会用来计算实体的边界。
meshScale• meshScale: Box3Vector3<> = new Box3Vector3(1 / 喵, 1 / 喵, 1 / 喵)
实体的缩放比例
这就是开车代码的核心.
话不多说直接上代码
1.碰到带有target标签的实体变身.
//选中所有带有标签target的实体,并遍历循环.
world.querySelectorAll('.target').forEach((e)=>{
e.onEntityContact(({entity,other})=>{ //设置目标模型的碰撞事件.
if(!other.isPlayer){return} //防止非玩家实体参与检测.
other.mesh=entity.mesh; //设置玩家的外观.
other.meshScale=entity.meshScale; //设置玩家外观缩放比例.
other.player.invisible=true; //如果模型比玩家小,就需要隐藏玩家的皮肤.
})
})
就这,这么简单!
别的问题回帖补充
QBZ_//选中所有带有标签target的实体,并遍历循环.
world.querySelectorAll('.target').forEach((e)=>{
e.onEntityContact(({entity,other})=>{ //设置目标模型的碰撞事件.
if(!other.isPlayer){return} //防止非玩家实体参与检测.
other.mesh=entity.mesh; //设置玩家的外观.
other.meshScale=entity.meshScale; //设置玩家外观缩放比例.
other.player.invisible=true; //如果模型比玩家小,就需要隐藏玩家的皮肤.
entity.destroy()
})
})点赞0
评论