猫史档案馆


【BOX3】末影珍珠进阶版教程

用户:治愈绾兮治愈绾兮查看:3 回复:13 评论:3 创建时间:2021-08-22T16:59:04


上一次我发了初级版直线末影珍珠代码,这一次变成了像起床中抛物线版的。

执行此代码需要在文件中有一个叫末影珍珠的模型

world.onPlayerJoin(({ entity }) => {
    entity.player.onPress(async ({ button, raycast}) => {
        if (button !== 'action1') {
            return;
        }
        const e = world.createEntity({
            mesh: 'mesh/末影珍珠.vb'
        });
        const chaoxiang = entity.player.facingDirection
        world.say(chaoxiang)
        e.position.copy(entity.position)
        e.velocity = chaoxiang.scale(2)
        e.velocity.y = raycast.direction.y * 2;
        e.onVoxelContact(({ x, y, z }) => {
            entity.position.set(x, y + 2, z)
            e.destroy()
        })
        e.onEntityContact(() => {
            entity.position.copy(e.position)
            e.destroy()
        })
    })
})


回复

上一页1 页 / 共 1下一页
幻煞幻煞

沙发

点赞0


评论


༺ཌༀ学海无涯༒苦作舟ༀད༻༺ཌༀ学海无涯༒苦作舟ༀད༻

啊这

点赞0


评论


指令者指令者

NB

点赞0


评论


神兽喵神兽喵

啊这

点赞0


评论


Lingooy_SheeranLingooy_Sheeran

轨道偏了...

点赞0


评论


指令者指令者

world.onPlayerJoin(({ entity }) => {
    entity.player.onPress(async ({ button, raycast}) => {
        if (button !== 'action1') {//如果不是右键
            return;//退出(群聊)
        }
        //如果是右键,扔出实体
        const e = world.createEntity({
            mesh: 'mesh/末影珍珠.vb'
        });
        const chaoxiang = entity.player.facingDirection
        world.say(chaoxiang)
        e.position.copy(entity.position)
        e.velocity = chaoxiang.scale(2)
        e.velocity.y = raycast.direction.y * 2;
        e.onVoxelContact(({ x, y, z }) => {
            entity.position.set(x, y + 2, z)//玩家传送过去
            e.destroy()//删除实体
        })
        e.onEntityContact(() => {
            entity.position.copy(e.position)
            e.destroy()
        })
    })
})

点赞0


评论


IaeaIaea

a'z

点赞0


评论


治愈绾兮治愈绾兮

咋又莫名其妙被顶起来了()()()

点赞0


评论


屑怪盗屑怪盗

沙发

点赞0


评论


无敌版滑稽战神无敌版滑稽战神

awa

点赞0


评论


小屑鹿小屑鹿

👀

点赞0


评论


一勺小汤_纪念号一勺小汤_纪念号

挖坟,顺便收藏

点赞0


评论


面具狐狸云绾兮面具狐狸云绾兮

《咋又莫名其妙被顶起来了()()()》

点赞0


评论