-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove workshop wings, free up wasd on textinput unmount * suppress pointer lock errors, general cleanup * add open in oculus menu button, enter vr on clicking continue in headset * change direction state from input space to player space, map left button to fly, fix xr movement * mute audio on page hide, pause menu dev mode * add .preload to useImage and useModel * comments and small refactors
- Loading branch information
1 parent
7e26481
commit cbc73ee
Showing
19 changed files
with
346 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useState } from "react"; | ||
import { Image, useImage, useKeypress } from "spacesvr"; | ||
import { useThree } from "@react-three/fiber"; | ||
|
||
const IMAGE_URL = | ||
"https://d1htv66kutdwsl.cloudfront.net/e7edec86-52b6-4734-9c43-ffd70bc5bef6/9d1e5c18-3fb5-4844-8b31-1a08b800976e.ktx2"; | ||
|
||
export default function PreloadImage() { | ||
const gl = useThree((st) => st.gl); | ||
|
||
const [mounted, setMounted] = useState(false); | ||
useKeypress("m", () => setMounted(!mounted), [mounted]); | ||
|
||
useImage.preload(IMAGE_URL, gl); | ||
|
||
if (!mounted) return null; | ||
|
||
return ( | ||
<Image | ||
src={IMAGE_URL} | ||
framed | ||
frameWidth={0.75} | ||
size={12} | ||
rotation-y={0} | ||
position={[-1.4, 1.5, -12]} | ||
/> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useEffect } from "react"; | ||
import { AudioContext } from "three"; | ||
|
||
export default function MuteOnHide() { | ||
useEffect(() => { | ||
function handleChange() { | ||
const context = AudioContext.getContext(); | ||
if (document.hidden) context.suspend(); | ||
else context.resume(); | ||
} | ||
|
||
document.addEventListener("visibilitychange", handleChange); | ||
return () => document.removeEventListener("visibilitychange", handleChange); | ||
}, []); | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.