
Lv.1
在 【屑冷光又来搞事情了?】双龙攻击特效 中回复
const Quat = new Box3Quaternion(0, 0, 0, 1);
world.onPress(({ entity, button, raycast: { direction }}) => {
if (button === 'action0') {
const ball = world.createEntity({
mesh: 'mesh/火球.vb',
position: entity.position,
gravity: false,
collides: false,
fixed: true,
})
const dragon_1 = world.createEntity({
mesh: 'mesh/黄金龙首.vb',
gravity: false,
collides: false,
fixed: true,
meshScale: [0.0625, 0.0625, 0.0625],
})
const dragon_2 = world.createEntity({
mesh: 'mesh/黄金龙首.vb',
gravity: false,
collides: false,
fixed: true,
meshScale: [0.0625, 0.0625, 0.0625],
})
const up = Math.atan2(direction.y, Math.sqrt(direction.x ** 2 + direction.z ** 2));
const angle = Math.atan2(direction.z, direction.x);
const startTick = world.currentTick;
dragon_1.lastPosition = dragon_2.lastPosition = new Box3Vector3(0, 0, 0);
const dragons = [dragon_1, dragon_2];
const radius = 3
for (const e of dragons) {
Object.assign(
e, {
particleRate: 100,
particleLifetime: 20,
particleSize: [8, 6, 4, 2, 0.5],
particleColor: [new Box3RGBColor(1, 1, 0), new Box3RGBColor(1, 1, 0), new Box3RGBColor(1, 0, 0), new Box3RGBColor(1, 0, 0), new Box3RGBColor(1, 1, 1),]
}
)
}
const ticker = world.onTick(() => {
if (world.currentTick - startTick > 200) {
ball.destroy();
dragon_1.destroy();
dragon_2.destroy();
ticker.cancel();
}
ball.velocity = dragon_1.velocity = dragon_2.velocity = direction.scale(3);
dragon_1.position = ball.position.add({
x: Math.cos(angle + Math.PI * 0.5) * Math.cos(up + world.currentTick * 0.3) * radius,
y: Math.sin(up + world.currentTick * 0.3) * radius, z: Math.sin(angle + Math.PI * 0.5) * Math.cos(up + world.currentTick * 0.3) * radius,
})
dragon_2.position = ball.position.add({
x: Math.cos(angle + Math.PI * 0.5) * Math.cos(up + world.currentTick * 0.3 + Math.PI) * radius,
y: Math.sin(up + world.currentTick * 0.3 + Math.PI) * radius,
z: Math.sin(angle + Math.PI * 0.5) * Math.cos(up + world.currentTick * 0.3 + Math.PI) * radius,
})
for (const e of dragons) {
const direction = e.position.sub(e.lastPosition);
e.meshOrientation = Quat.rotateY(Math.PI * 0.5).rotateX(Math.atan2(direction.y, Math.sqrt(direction.x ** 2 + direction.z ** 2))).rotateY(Math.atan2(direction.z, direction.x));
e.lastPosition.copy(e.position);
}
})
}
})2022-02-02T09:57:42 点赞:0
在 【地图招聘】马云编程猫招人一起做图了,有兴趣的快来看看吧!!! 中回复
我?爱探险的想得起呀 box3.codemao.cn/u/RyEJuJ6HYAttaDr
2022-05-26T19:25:35 点赞:0
在 神奇代码岛代码师知识竞答() 中回复
1.C
2.D
3.C
4.B
5.C
6.C
7.D
8.D
随便答一答()
9.D
10.C
11.B
12.D
2022-08-21T17:03:03 点赞:0