Skip to content

Commit

Permalink
fix: only set default camera settings to first camera
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed May 9, 2023
1 parent 34d6274 commit 7f1e7cd
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/core/nodeOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,16 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
instance = new target(...props.args)
}

if (instance.isCamera) {
if (instance.isCamera && firstCamera) {
if (!props?.position) {
instance.position.set(3, 3, 3)
}
if (!props?.lookAt) {
instance.lookAt(0, 0, 0)
}
if (firstCamera) {
const { setFirstCamera } = useCamera()
setFirstCamera(instance)
firstCamera = false
}
const { setFirstCamera } = useCamera()
setFirstCamera(instance)
firstCamera = false
}

if (props?.attach === undefined) {
Expand Down

0 comments on commit 7f1e7cd

Please sign in to comment.