Skip to content

Commit

Permalink
feat: add debug to leva
Browse files Browse the repository at this point in the history
  • Loading branch information
Onxi95 committed May 17, 2024
1 parent 62ae66b commit 3317cec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/GyroscopeExperience.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ const radians = (deg: number) => (deg * Math.PI) / 180;

export const GyroscopeExperience = () => {
const [gravity, setGravity] = useState(defaultGravity);
const { gravityMultiplier, cubesCount } = useControls({
const { gravityMultiplier, cubesCount, debug } = useControls({
gravityMultiplier: 9,
cubesCount: 50,
debug: false,
});

const cubesRef =
Expand Down Expand Up @@ -108,7 +109,7 @@ export const GyroscopeExperience = () => {
return (
<>
<Text fontSize={0.3} color="darkblue">
{gravity.toString()}
{debug && gravity.toString()}
</Text>
<OrbitControls
makeDefault
Expand All @@ -122,7 +123,7 @@ export const GyroscopeExperience = () => {
shadow-mapSize={2048}
/>
<ambientLight intensity={0.5} />
<Physics debug gravity={gravity}>
<Physics debug={debug} gravity={gravity}>
<RigidBody
type="fixed"
restitution={0}
Expand Down

0 comments on commit 3317cec

Please sign in to comment.