猫史档案馆


发射一个模型【简陋教程】

用户:Lingooy_月Lingooy_月查看:5 回复:8 评论:5 创建时间:2021-06-21T20:01:26


首先,你得放个要发射的模型() 再放个用于装饰,拿在手上的模型()   console.clear() const Quat = new Box3Quaternion(0,0,0,1) world.onRelease(async ({entity, button, raycast:{direction}}) => { //每当有按钮被按下     if (button == Box3ButtonType.ACTION0) {         const 喵 = world.createEntity({             mesh:'发射的模型',             position:entity.position,             meshScale:new Box3Vector3(0.1, 0.1, 0.1),             collides:false         })         喵.gravity = false         const 喵_orientation = Quat.rotateY(Math.atan2(direction.z, direction.x)).rotateY(-Math.PI / 2).rotateY(-Math.PI / 2)         喵.meshOrientation.copy(喵_orientation)         for(i = 0; i <= 4; i++){             喵.position.x += direction.x             喵.position.z += direction.z             await sleep(200)         }         await sleep(1000)         喵.destroy()     } }) world.onPlayerJoin(({ entity }) => { entity.player.addWearable({ bodyPart: Box3BodyPart.RIGHT_HAND, mesh: '拿的东西', orientation: new Box3Quaternion(0, 180, 60, -160).rotateY(Math.PI / 2.5), scale: new Box3Vector3(1, 1, 1), offset: new Box3Vector3(0, 0.2, 0.6), })   就完事了 doge~

 


回复

上一页1 页 / 共 1下一页
Lingooy_月Lingooy_月

代码咋同样

点赞0


评论


Lingooy_月Lingooy_月

console.clear() const Quat = new Box3Quaternion(0,0,0,1) world.onRelease(async ({entity, button, raycast:{direction}}) => { //每当有按钮被按下     if (button == Box3ButtonType.ACTION0) {         const 喵 = world.createEntity({             mesh:'发射模型',             position:entity.position,             meshScale:new Box3Vector3(0.1, 0.1, 0.1),             collides:false         })         喵.gravity = false         const 喵_orientation = Quat.rotateY(Math.atan2(direction.z, direction.x)).rotateY(-Math.PI / 2).rotateY(-Math.PI / 2)         喵.meshOrientation.copy(喵_orientation)         for(i = 0; i <= 4; i++){             喵.position.x += direction.x             喵.position.z += direction.z             await sleep(200)         }         await sleep(1000)         喵.destroy()     } }) world.onPlayerJoin(({ entity }) => { entity.player.addWearable({ bodyPart: Box3BodyPart.RIGHT_HAND, mesh: '装饰', orientation: new Box3Quaternion(0, 180, 60, -160).rotateY(Math.PI / 2.5), scale: new Box3Vector3(1, 1, 1), offset: new Box3Vector3(0, 0.2, 0.6), })

点赞0


评论


Lingooy_月Lingooy_月

console.clear()

点赞0


评论


Lingooy_月Lingooy_月

const Quat = new Box3Quaternion(0,0,0,1) world.onRelease(async ({entity, button, raycast:{direction}}) => { //每当有按钮被按下     if (button == Box3ButtonType.ACTION0) {         const 喵 = world.createEntity({             mesh:'mesh/斩(红黑).vb',             position:entity.position,             meshScale:new Box3Vector3(0.1, 0.1, 0.1),             collides:false         })         喵.gravity = false         const 喵_orientation = Quat.rotateY(Math.atan2(direction.z, direction.x)).rotateY(-Math.PI / 2).rotateY(-Math.PI / 2)         喵.meshOrientation.copy(喵_orientation)         for(i = 0; i <= 4; i++){             喵.position.x += direction.x             喵.position.z += direction.z             await sleep(200)         }         await sleep(1000)         喵.destroy()     } })

点赞0


评论


神岛吉吉喵神岛吉吉喵

分享教程可以多使用换行,以及代码插入功能哦emotion_编程猫_加油

点赞0


评论


薹灣解放再改名薹灣解放再改名

首先,你得放个要发射的模型() 再放个用于装饰,拿在手上的模型()   console.clear() const Quat = new Box3Quaternion(0,0,0,1) world.onRelease(async ({entity, button, raycast:{direction}}) => { //每当有按钮被按下     if (button == Box3ButtonType.ACTION0) {         const 喵 = world.createEntity({             mesh:'发射的模型',             position:entity.position,             meshScale:new Box3Vector3(0.1, 0.1, 0.1),             collides:false         })         喵.gravity = false         const 喵_orientation = Quat.rotateY(Math.atan2(direction.z, direction.x)).rotateY(-Math.PI / 2).rotateY(-Math.PI / 2)         喵.meshOrientation.copy(喵_orientation)         for(i = 0; i <= 4; i++){             喵.position.x += direction.x             喵.position.z += direction.z             await sleep(200)         }         await sleep(1000)         喵.destroy()     } }) world.onPlayerJoin(({ entity }) => { entity.player.addWearable({ bodyPart: Box3BodyPart.RIGHT_HAND, mesh: '拿的东西', orientation: new Box3Quaternion(0, 180, 60, -160).rotateY(Math.PI / 2.5), scale: new Box3Vector3(1, 1, 1), offset: new Box3Vector3(0, 0.2, 0.6), })  doge~

点赞0


评论


快乐的皮卡丘A快乐的皮卡丘A

点插入代码

点赞0


评论


坦率的血翼蝠5801坦率的血翼蝠5801

console.clear()
const Quat = new Box3Quaternion(0,0,0,1)
world.onRelease(async ({entity, button, raycast:{direction}}) => { 
//每当有按钮被按下
     if (button == Box3ButtonType.ACTION0) {
         const 喵 = world.createEntity({
             mesh:'发射模型',
             position:entity.position,
             meshScale:new Box3Vector3(0.1, 0.1, 0.1),
             collides:false
         })
         喵.gravity = false
         const 喵_orientation = Quat.rotateY(Math.atan2(direction.z, direction.x)).rotateY(-Math.PI / 2).rotateY(-Math.PI / 2)
         喵.meshOrientation.copy(喵_orientation)
         for(i = 0; i <= 4; i++){
             喵.position.x += direction.x
             喵.position.z += direction.z
             await sleep(200)
         }
         await sleep(1000)
         喵.destroy()
     }
 })
world.onPlayerJoin(({ entity }) => {
    entity.player.addWearable({
        bodyPart: Box3BodyPart.RIGHT_HAND,
        mesh: '装饰',
        orientation: new Box3Quaternion(0, 180, 60, -160).rotateY(Math.PI / 2.5),
        scale: new Box3Vector3(1, 1, 1), offset: new Box3Vector3(0, 0.2, 0.6), 
    })
})

点赞0


评论