用户:
烨烨小栗子查看:2 回复:4 评论:2 创建时间:2023-01-06T16:02:50
const lampSwitch = world.querySelector('#黄色敞篷越野车-1')
lampSwitch.enableInteract = true
lampSwitch.interactRadius = 2
lampSwitch.interactHint = lampSwitch.id
lampSwitch.interactColor = new Box3RGBColor(0,1,0)
lampSwitch.onInteract(()=>{
lampSwitch.collides = true
lampSwitch.fixed = true
lampSwitch.onEntityContact(({ other }) => {
if (other.isPlayer) {
other.player.invisible = true // 玩家皮肤隐藏
other.mesh = e.mesh // 玩家的外形换成当前实体的外形
other.meshScale.copy(e.meshScale) // 玩家外形的缩放比例设成跟当前实体一样
other.player.scale = e.meshScale.scale(e.bounds.y / other.bounds.y) //喵家的隐形碰撞盒缩放到模型刚好贴地
}
})
})
伴雪纷飞other.mesh = e.mesh // 玩家的外形换成当前实体的外形
other.meshScale.copy(e.meshScale) // 玩家外形的缩放比例设成跟当前实体一样
other.player.scale = e.meshScale.scale(e.bounds.y / other.bounds.y) //喵家的隐形碰撞盒缩放到模型刚好贴地
下次复制别人的代码注意点( )
你的实体e没有定义
点赞0
评论