-
Notifications
You must be signed in to change notification settings - Fork 1
/
Light.js
34 lines (24 loc) · 843 Bytes
/
Light.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
31
32
33
34
import React, { useEffect, useRef, useState } from "react";
import { useFrame, useLoader } from "@react-three/fiber";
import { Mesh, MeshBasicMaterial } from "three";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
export const Light = () => {
const url = "Models/Light/Light.gltf"
const gltf = useLoader(GLTFLoader, url);
useEffect(() => {
gltf.scene.scale.set(0.009, 0.009, 0.009);
gltf.scene.position.set(-3.5, 0, 2);
gltf.scene.traverse((object) => {
if (object instanceof Mesh) {
object.castShadow = true;
object.receiveShadow = true;
object.material.envMapIntensity = 20;
}
})
}, [gltf])
return (
<group>
<primitive object={gltf.scene} />
</group>
)
}