gpt4 book ai didi

javascript - 粒子.subSelf()未定义不是一个函数

转载 作者:行者123 更新时间:2023-12-03 12:20:36 27 4
gpt4 key购买 nike

我试图为具有三的粒子提供速度和原点,但我无法添加原点

 function getOrigin() {
return new THREE.Vector3(Weapon.vehicle.position.x, Weapon.vehicle.position.y, Weapon.vehicle.position.z);
}
function start() {
time = Weapon.time;
done = false;

var origin = getOrigin();
particles = new THREE.Geometry();
var pMaterial = new THREE.ParticleBasicMaterial({
color: Weapon.explosion.color,
size: Weapon.explosion.size,
map: THREE.ImageUtils.loadTexture("img/particula.png"),
blending: THREE.AdditiveBlending,
transparent: true
});
for(var p = 0; p < particleCount; p++) {
// create a particle with random
// position values, -250 -> 250
var pX = (Math.random() * Weapon.vehicle.size.x) - (Weapon.vehicle.size.x / 2),
pY = (Math.random() * Weapon.vehicle.size.y) - (Weapon.vehicle.size.y / 2),
pZ = (Math.random() * Weapon.vehicle.size.z) - (Weapon.vehicle.size.z / 2),
particle = new THREE.Vector3(pX, pY, pZ);

// create a velocity vector
particle.velocity = particle.clone();
particle.addSelf(origin);

// add it to the geometry
particles.vertices.push(particle);
}

// create the particle system
particleSystem = new THREE.ParticleSystem(particles, pMaterial);
particleSystem.sortParticles = true;
scene.add(particleSystem);
}

粒子.addSelf(origin);这条线给了我一个未定义的函数,它可以在旧版本的三元组中正常工作,但我想从 r52 升级到 r67,并且我发现了很多问题,如果您有任何想法,我们将不胜感激。

最佳答案

您可以在此处找到迁移说明:https://github.com/mrdoob/three.js/wiki/Migration以及此处的发行说明:https://github.com/mrdoob/three.js/releases

关于javascript - 粒子.subSelf()未定义不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24461312/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com