猫史档案馆


求助(帮我看看哪错了)

用户:烨烨小栗子烨烨小栗子查看: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) //喵家的隐形碰撞盒缩放到模型刚好贴地
        }
    })
})


回复

上一页1 页 / 共 1下一页
搬码喵搬码喵

报错内容

点赞0


评论


无极玄天无极玄天

链接

点赞0


评论


名探酱名探酱

哪报错了,最有可能的就是实体(模型)名字不对

点赞1


评论


伴雪纷飞伴雪纷飞

other.mesh = e.mesh // 玩家的外形换成当前实体的外形
other.meshScale.copy(e.meshScale) // 玩家外形的缩放比例设成跟当前实体一样
other.player.scale = e.meshScale.scale(e.bounds.y / other.bounds.y) //喵家的隐形碰撞盒缩放到模型刚好贴地

下次复制别人的代码注意点( )

你的实体e没有定义

点赞0


评论