Skip to content

Commit

Permalink
Merge pull request #8 from tscircuit/3d-loading-boxes
Browse files Browse the repository at this point in the history
3d loading boxes
  • Loading branch information
seveibar authored Jul 11, 2024
2 parents 4680241 + 33376ad commit 87e4aa7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/three-components/MixedStlModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ export function MixedStlModel({
// }, [url])
const obj = useGlobalObjLoader(url)

return (
<group
rotation={rotation}
position={position}
key={Boolean(obj).toString()}
>
{obj && <primitive object={obj} />}
</group>
)
if (!obj) {
return (
<mesh position={position}>
<boxGeometry args={[0.5, 0.5, 0.5]} />
<meshStandardMaterial transparent color="red" opacity={0.25} />
</mesh>
)
}

return <primitive rotation={rotation} position={position} object={obj} />
}

0 comments on commit 87e4aa7

Please sign in to comment.