Skip to content

Commit

Permalink
feat: enable gravityModifier two constants mode (#1964)
Browse files Browse the repository at this point in the history
  • Loading branch information
JujieX authored Jan 12, 2024
1 parent 5ad958a commit 613446d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/particle/enums/ParticleRandomSubSeeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export enum ParticleRandomSubSeeds {
SizeOverLifetime = 0x591bc05c,
RotationOverLifetime = 0x40eb95e4,
TextureSheetAnimation = 0xbc524e5,
Shape = 0xaf502044
Shape = 0xaf502044,
GravityModifier = 0xa47b8c4d
}
5 changes: 4 additions & 1 deletion packages/core/src/particle/modules/MainModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ export class MainModule implements ICustomClone {
@ignoreClone
readonly _startRotationRand = new Rand(0, ParticleRandomSubSeeds.StartRotation);

@ignoreClone
readonly _gravityModifierRand = new Rand(0, ParticleRandomSubSeeds.GravityModifier);

@ignoreClone
private _generator: ParticleGenerator;
@ignoreClone
Expand Down Expand Up @@ -196,7 +199,7 @@ export class MainModule implements ICustomClone {
}

const particleGravity = this._gravity;
const gravityModifierValue = this.gravityModifier.evaluate(undefined, undefined);
const gravityModifierValue = this.gravityModifier.evaluate(undefined, this._gravityModifierRand.random());
Vector3.scale(renderer.scene.physics.gravity, gravityModifierValue, particleGravity);

shaderData.setVector3(MainModule._gravity, particleGravity);
Expand Down

0 comments on commit 613446d

Please sign in to comment.