Skip to content

Object lookAt functionality. #1649

Discussion options

You must be logged in to vote

I've figured out the answer to the question,

You need to use this in a useLayoutEffect hook

something like this

  const mesh = useRef(null)

  useLayoutEffect(() => {
    mesh.current.lookAt(0, 0, 0)
  }, [])

  return (
    <mesh ref={mesh} position={[0, 1, 1]} {...props}>
      <circleGeometry attach='geometry' args={[1, 12]} />
      <meshBasicMaterial side={THREE.DoubleSide} color={0x000fff} />
    </mesh>
  )

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@drcmda
Comment options

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