Skip to content

Whats the best way to add Player Body to Physics World #105

Answered by vladmdgolam
schwarzsky asked this question in General
Discussion options

You must be logged in to vote

I would do it this way:

function Banana(props) {
  const [model, setModel] = useState()

  const [ref] = useBox(() => ({
    mass: 1,
    ...props,
  }))

  useMemo(() => new GLTFLoader().load("model.gltf", setModel), [true])

  return (
    <group ref={ref}>
      {model ? <primitive object={gltf.scene} dispose={null} /> : null}
    </group>
  )
}

Replies: 1 comment 1 reply

Comment options

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

Answer selected by codynova
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants