Skip to content

Commit

Permalink
Merge pull request #6380 from mozilla/bitecs-spawner-transform-animat…
Browse files Browse the repository at this point in the history
…ion-fix

bitECS - Spawner scale and animation fixes
  • Loading branch information
keianhzo authored Nov 27, 2023
2 parents d2ea71e + 022a200 commit 6467b94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/bit-systems/object-spawner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { coroutine } from "../utils/coroutine";
import { createNetworkedMedia } from "../utils/create-networked-entity";
import { EntityID } from "../utils/networking-types";
import { setMatrixWorld } from "../utils/three-utils";
import { animateScale } from "./media-loading";
import { sleep } from "../utils/async-utils";

export enum OBJECT_SPAWNER_FLAGS {
/** Apply gravity to spawned objects */
Expand All @@ -18,8 +20,8 @@ function* spawnObjectJob(world: HubsWorld, spawner: EntityID) {
const spawned = createNetworkedMedia(world, {
src: APP.getString(ObjectSpawner.src[spawner])!,
recenter: true,
resize: true,
animateLoad: true,
resize: false,
animateLoad: false,
isObjectMenuTarget: true
});

Expand All @@ -34,6 +36,9 @@ function* spawnObjectJob(world: HubsWorld, spawner: EntityID) {
spawnerObj.updateMatrices();
const spawnedObj = world.eid2obj.get(spawned)!;
setMatrixWorld(spawnedObj, spawnerObj.matrixWorld);

yield sleep(100);
yield* animateScale(world, spawner);
}

// TODO type for coroutine
Expand Down
2 changes: 1 addition & 1 deletion src/inflators/spawner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function inflateSpawner(world: HubsWorld, eid: number, props: SpawnerPara
src: props.src,
recenter: true,
resize: false,
animateLoad: false,
animateLoad: true,
isObjectMenuTarget: false
});

Expand Down

0 comments on commit 6467b94

Please sign in to comment.