-
Notifications
You must be signed in to change notification settings - Fork 1
/
Bannana.js
30 lines (22 loc) · 874 Bytes
/
Bannana.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React, { useEffect, useRef, useState } from "react";
import { useFrame, useLoader } from "@react-three/fiber";
import { Mesh } from "three";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
export const Bannana = () => {
const [active, setActive] = useState(false)
const url = "Models/Bannana/Bannana.gltf"
const gltf = useLoader(GLTFLoader, url);
useEffect(() => {
gltf.scene.scale.set(0.6, 0.5, 0.5);
gltf.scene.position.set(2, 1.1, 3.0);
gltf.scene.rotation.set(1.5, 0, Math.PI / 3.5);
gltf.scene.traverse((object) => {
if (object instanceof Mesh) {
object.castShadow = true;
object.receiveShadow = true;
object.material.envMapIntensity = 20;
}
})
}, [gltf])
return <primitive object={gltf.scene} />
}