Skip to content

Commit

Permalink
fix(useAnimations): passing root to mixer init if it is Object3D (#1307)
Browse files Browse the repository at this point in the history
  • Loading branch information
casualWaist committed May 8, 2023
1 parent b841c4c commit a590d3d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/useAnimations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function useAnimations<T extends AnimationClip>(
const [actualRef] = React.useState(() => (root ? (root instanceof Object3D ? { current: root } : root) : ref))
// eslint-disable-next-line prettier/prettier
const [mixer] = React.useState(() => new AnimationMixer(undefined as unknown as Object3D))
React.useLayoutEffect(() => void ((mixer as any)._root = actualRef.current), [mixer, root])
const lazyActions = React.useRef({})
const [api] = React.useState<Api<T>>(() => {
const actions = {} as { [key in T['name']]: AnimationAction | null }
Expand Down

1 comment on commit a590d3d

@vercel
Copy link

@vercel vercel bot commented on a590d3d May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.