Skip to content

Commit 86840cd

Browse files
chore: cleanup
1 parent b44cc10 commit 86840cd

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ Controllers can be added with `<Controllers />` for [motion-controllers](https:/
152152
rayMaterial={{ color: 'blue' }}
153153
/** Whether to hide controllers' rays on blur. Default is `false` */
154154
hideRaysOnBlur={false}
155+
/**
156+
* Optional environment map to apply to controller models.
157+
* Useful for make controllers look more realistic
158+
* if you don't want to apply an env map globally on a scene
159+
*/
160+
envMap={Texture}
161+
/**
162+
* Optional environment map intensity to apply to controller models.
163+
* Useful for tweaking the env map intensity if they look too bright or dark
164+
*/
165+
envMapIntensity={1}
155166
/>
156167
<Hands
157168
// Optional custom models per hand. Default is the Oculus hand model
@@ -162,7 +173,7 @@ Controllers can be added with `<Controllers />` for [motion-controllers](https:/
162173

163174
### Environment map
164175

165-
You can set environment map and/or it's intensity on controller models via props on `<Controllers />`. See [ControllerEnvMap](./examples/src/demos/ControllersEnvMap.tsx) to find out how to do it.
176+
You can set an environment map and/or its intensity on controller models via the `envMap` and `envMapIntensity` props of `<Controllers />`. See [ControllerEnvMap](./examples/src/demos/ControllersEnvMap.tsx) for reference.
166177

167178
### useController
168179

@@ -176,7 +187,7 @@ const gazeController = useController('none')
176187

177188
### XRController
178189

179-
`XRController` is an long-living `Object3D` that represents an [`XRInputSource`](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource) with the following properties:
190+
`XRController` is a long-living `Object3D` that represents an [`XRInputSource`](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource) with the following properties:
180191

181192
```jsx
182193
index: number

src/Controllers.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ export interface ControllersProps {
6565
/** Whether to hide controllers' rays on blur. Default is `false` */
6666
hideRaysOnBlur?: boolean
6767
/**
68-
* Optional environment map to apply to controllers' models
68+
* Optional environment map to apply to controller models.
6969
* Useful for make controllers look more realistic
70-
* if you don't want to apply env map globally on a scene
70+
* if you don't want to apply an env map globally on a scene
7171
*/
7272
envMap?: THREE.Texture
7373
/**
74-
* Optional environment map intensity to apply to controllers' models
75-
* Useful for tweaking the env map intensity if they look too bright or too dark
74+
* Optional environment map intensity to apply to controller models.
75+
* Useful for tweaking the env map intensity if they look too bright or dark
7676
*/
7777
envMapIntensity?: number
7878
}
@@ -89,10 +89,10 @@ const ControllerModel = ({
8989
const xrControllerModelRef = React.useRef<XRControllerModel | null>(null)
9090
const setEnvironmentMapRef = useCallbackRef((xrControllerModel: XRControllerModel) => {
9191
if (envMap == null) return
92-
xrControllerModel.setEnvironmentMap(envMap ?? null)
92+
xrControllerModel.setEnvironmentMap(envMap)
9393
})
9494
const clearEnvironmentMapRef = useCallbackRef((xrControllerModel: XRControllerModel) => xrControllerModel.setEnvironmentMap(null))
95-
95+
9696
const setEnvironmentMapIntensityRef = useCallbackRef((xrControllerModel: XRControllerModel) => {
9797
if (envMapIntensity == null) return
9898
xrControllerModel.setEnvironmentMapIntensity(envMapIntensity)

0 commit comments

Comments
 (0)