Skip to content

Commit

Permalink
Made requested changes
Browse files Browse the repository at this point in the history
Used a label for consistency
Modified the WorldToPixelSpace function
  • Loading branch information
Dhruv-0-Arora committed Jul 18, 2024
1 parent 4f50c17 commit 692bb1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion fission/src/mirabuf/MirabufSceneObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class MirabufSceneObject extends SceneObject {

// creating nametag for robots
if (this.miraType === MiraType.ROBOT) {
this._nameTag = new SceneOverlayTag("Hunter Barclah")
this._nameTag = new SceneOverlayTag("Ernie")
}
}

Expand Down
6 changes: 1 addition & 5 deletions fission/src/systems/scene/SceneRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,7 @@ class SceneRenderer extends WorldSystem {
public WorldToPixelSpace(world: THREE.Vector3): PixelSpaceCoord {
this._mainCamera.updateMatrixWorld()
const screenSpace = world.project(this._mainCamera)
const widthHalf = window.innerWidth / 2
const heightHalf = window.innerHeight / 2
const x = screenSpace.x * widthHalf + widthHalf
const y = -(screenSpace.y * heightHalf) + heightHalf
return [x, y]
return [(window.innerWidth * (screenSpace.x + 1.0)) / 2.0, (window.innerHeight * (1.0 - screenSpace.y)) / 2.0]
}

/**
Expand Down
5 changes: 2 additions & 3 deletions fission/src/ui/components/SceneOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SceneOverlayTagEvent,
SceneOverlayTagEventKey,
} from "./SceneOverlayEvents"
import Label, { LabelSize } from "./Label"

const tagMap = new Map<number, SceneOverlayTag>()

Expand All @@ -32,9 +33,7 @@ function SceneOverlay() {
transform: "translate(-50%, -100%)",
}}
>
<h1 className="text-2xl text-white font-sans" style={{ fontWeight: "bold" }}>
{x.text}
</h1>
<Label size={LabelSize.Large}>{x.text}</Label>
</div>
))
}, [])
Expand Down

0 comments on commit 692bb1d

Please sign in to comment.