Skip to content
Discussion options

You must be logged in to vote
<bufferGeometry ref={geom} attach="geometry"/>

This is your problem. The return from useLoader is typically an object, you should use it like this:

export const Model = ({url}) => {

    const geom = useLoader(STLLoader, book)

    return (
        <Canvas>
            <mesh>
                <primitive object={geom} attach="geometry"/> // note I've used primitive.
                <meshStandardMaterial color="hotpink"/>
            </mesh>
            <ambientLight/>
            <pointLight position={[10, 10, 10]}/>
        </Canvas>
    )
}

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@AstroNik
Comment options

@joshuaellis
Comment options

@AstroNik
Comment options

Answer selected by AstroNik
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants