add random to noise sample point (#12534)

This commit is contained in:
zxx43
2022-08-30 11:51:32 +08:00
committed by GitHub
parent 12ab61220b
commit 8a9e239abb
+6 -1
View File
@@ -234,6 +234,8 @@ export class NoiseModule extends ParticleModuleBase {
private noise: ParticleNoise = new ParticleNoise();
private samplePosition: Vec3 = new Vec3();
public animate (particle: Particle, dt: number) {
this.noise.setTime(particle.particleSystem.time);
this.noise.setSpeed(this.noiseSpeedX, this.noiseSpeedY, this.noiseSpeedZ);
@@ -241,7 +243,10 @@ export class NoiseModule extends ParticleModuleBase {
this.noise.setAbs(this.remapX, this.remapY, this.remapZ);
this.noise.setAmplititude(this.strengthX, this.strengthY, this.strengthZ);
this.noise.setOctaves(this.octaves, this.octaveMultiplier, this.octaveScale);
this.noise.setSamplePoint(particle.position);
this.samplePosition.set(particle.position);
this.samplePosition.add3f(Math.random() * 1.0, Math.random() * 1.0, Math.random() * 1.0);
this.noise.setSamplePoint(this.samplePosition);
this.noise.getNoiseParticle();
const noisePosition: Vec3 = this.noise.getResult();