Skip to content

Commit

Permalink
update parent transform and fix trail batch as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alchemist0823 committed Aug 27, 2024
1 parent 9fe3832 commit adebaa6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/three.quarks/src/SpriteBatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,15 @@ export class SpriteBatch extends VFXBatch {
}

this.systems.forEach((system) => {
if ((system.emitter as unknown as Object3D).updateMatrixWorld) {
(system.emitter as unknown as Object3D).updateWorldMatrix(true, false);
(system.emitter as unknown as Object3D).updateMatrixWorld(true);
}
const particles = system.particles;
const particleNum = system.particleNum;
const rotation = this.quaternion2_;
const translation = this.vector2_;
const scale = this.vector3_;
if ((system.emitter as unknown as Object3D).updateMatrixWorld)
(system.emitter as unknown as Object3D).updateMatrixWorld(true);
system.emitter.matrixWorld.decompose(translation, rotation, scale);
this.rotationMat_.setFromMatrix4(system.emitter.matrixWorld);

Expand Down
6 changes: 5 additions & 1 deletion packages/three.quarks/src/TrailBatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Uniform,
DynamicDrawUsage,
BufferGeometry,
BufferAttribute,
BufferAttribute, Object3D,
} from 'three';

import trail_frag from './shaders/trail_frag.glsl';
Expand Down Expand Up @@ -152,6 +152,10 @@ export class TrailBatch extends VFXBatch {
}

this.systems.forEach((system) => {
if ((system.emitter as unknown as Object3D).updateMatrixWorld) {
(system.emitter as unknown as Object3D).updateWorldMatrix(true, false);
(system.emitter as unknown as Object3D).updateMatrixWorld(true);
}
const rotation = this.quaternion_;
const translation = this.vector2_;
const scale = this.vector3_;
Expand Down

0 comments on commit adebaa6

Please sign in to comment.