Skip to content

How to switch to a camera defined in a loaded glTF scene? #1999

Answered by fortinmike
fortinmike asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, so I figured it out from the following snippet #181 (comment) and the useThree documentation. Maybe this should be documented in the GLTF section of the documentation?

My solution to switch to the gltf camera is this:

useEffect(() => set({ camera: gltf.cameras[0] }), [gltf.cameras, set]);

Now to get the camera animation playing!

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@fortinmike
Comment options

@ashleymvanduzer
Comment options

@drcmda
Comment options

@fortinmike
Comment options

@Ferenc1886Git
Comment options

Answer selected by fortinmike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants