Skip to content

Commit

Permalink
Fix my avatar being unnecessarily reloaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
digisomni committed Nov 14, 2023
1 parent 32f4c12 commit 917826e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/modules/scene/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ export class ResourceManager {
return { rootUrl, filename };
}

public async loadMyAvatar(modelUrl: string): Promise<IAvatarResult> {
return this._loadAvatar(modelUrl);
}

public async loadAvatar(modelUrl: string): Promise<IAvatarResult> {
const avatar = await this._loadAvatar(modelUrl);
return avatar;
Expand Down
7 changes: 5 additions & 2 deletions src/modules/scene/vscene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ export class VScene {
}

// setup avatar
await this.loadMyAvatar(avatarModelURL);
if (!this._myAvatar) {
await this.loadMyAvatar(avatarModelURL);
}

if (this._myAvatar) {
this._myAvatar.position = avatarPos ?? new Vector3(0, 1, 0);
this._myAvatar.rotationQuaternion =
Expand Down Expand Up @@ -378,7 +381,7 @@ export class VScene {
previousAvatar.dispose();
}

const result = await this._resourceManager.loadMyAvatar(
const result = await this._resourceManager.loadAvatar(
this._myAvatarModelURL
);
let boundingVectors = {
Expand Down

0 comments on commit 917826e

Please sign in to comment.