Skip to content

Commit

Permalink
Feature/tooltip improvements (#120)
Browse files Browse the repository at this point in the history
* reposition the CharacterTooltip to make it more discreet and improve environment visibility

* fades out local character's tooltip after 10 seconds, while keeping remote players'
  • Loading branch information
TheCodeTherapy authored Mar 19, 2024
1 parent c9d5b8c commit 1bd55a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class CharacterManager {
);
this.localCharacter.position.set(spawnPosition.x, spawnPosition.y, spawnPosition.z);
this.localCharacter.rotation.set(spawnRotation.x, spawnRotation.y, spawnRotation.z);
character.tooltip?.setText(`${id}`);
character.tooltip?.setText(`${id}`, true);
this.group.add(character);
this.localCharacterSpawned = true;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/3d-web-client-core/src/character/CharacterTooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const fontScale = 5;
const defaultLabelColor = new Color(0x000000);
const defaultFontColor = new Color(0xffffff);
const defaultLabelAlignment = LabelAlignment.center;
const defaultLabelFontSize = 9;
const defaultLabelFontSize = 8;
const defaultLabelPadding = 0;
const defaultLabelWidth = 0.25;
const defaultLabelHeight = 0.125;
const defaultLabelHeight = 0.1;
const defaultLabelCastShadows = true;

const tooltipGeometry = new PlaneGeometry(1, 1, 1, 1);
Expand All @@ -34,7 +34,7 @@ export class CharacterTooltip extends Mesh {
private visibleOpacity: number = 0.85;
private targetOpacity: number = 0;
private fadingSpeed: number = 0.02;
private secondsToFadeOut: number = 15;
private secondsToFadeOut: number = 10;

private props = {
content: "",
Expand Down Expand Up @@ -98,7 +98,7 @@ export class CharacterTooltip extends Mesh {

this.scale.x = width / (100 * fontScale);
this.scale.y = height / (100 * fontScale);
this.position.y = 1.6;
this.position.y = 1.4;
}

setText(text: string, temporary: boolean = false) {
Expand Down

0 comments on commit 1bd55a6

Please sign in to comment.