Fix build (bypass typescript)

master
Ian Mancini 4 years ago
parent 4541b9a4b7
commit 9314a8b06f

@ -39,7 +39,7 @@ const Scene: React.FC = () => {
return ( return (
<> <>
<Stats /> {process.env.NODE_ENV !== 'production' ? <Stats /> : null}
<Lighting /> <Lighting />
<Suspense fallback={null}> <Suspense fallback={null}>
@ -68,88 +68,9 @@ const Scene: React.FC = () => {
EN CONSTRUCCIÓN EN CONSTRUCCIÓN
</Text> </Text>
<Text <Users />
position={[-20.086780548095703, 10.144491195678711, -111.45488739013672]} <Effects />
quaternion={new Quaternion().fromArray([
0,
-0.9658790826797485,
0,
-0.258993536233902,
])}
color="white"
fontSize={0.8}
font="https://fonts.gstatic.com/s/raleway/v14/1Ptrg8zYS_SKggPNwK4vaqI.woff"
anchorX="center"
anchorY="middle"
>
Aguyje Angirũ
</Text>
<Text
position={[-31.250932693481445, 7.049933910369873, -90.546630859375]}
quaternion={new Quaternion().fromArray([
0,
-0.9658790826797485,
0,
-0.258993536233902,
])}
maxWidth={12}
color="white"
fontSize={0.4}
font="https://fonts.gstatic.com/s/raleway/v14/1Ptrg8zYS_SKggPNwK4vaqI.woff"
anchorX="center"
anchorY="middle"
>
LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT, SED DO EIUSMOD TEMPOR
INCIDIDUNT UT LABORE ET DOLORE MAGNA ALIQUA. UT ENIM AD MINIM VENIAM, QUIS
NOSTRUD EXERCITATION ULLAMCO LABORIS NISI UT ALIQUIP EX EA COMMODO CONSEQUAT.
</Text>
<Text
position={[-33.941890716552734, 10.144491195678711, -126.15272521972656]}
quaternion={new Quaternion().fromArray([
0,
-0.8729466199874878,
0,
-0.4878157675266266,
])}
color="white"
fontSize={0.6}
font="https://fonts.gstatic.com/s/raleway/v14/1Ptrg8zYS_SKggPNwK4vaqI.woff"
anchorX="center"
anchorY="middle"
>
La Traicion de la Realidad
</Text>
<Text
position={[-27.612287521362305, 10.144491195678711, -117.4875259399414]}
quaternion={new Quaternion().fromArray([
0,
-0.9136363863945007,
0,
-0.40653231739997864,
])}
color="white"
fontSize={0.8}
font="https://fonts.gstatic.com/s/raleway/v14/1Ptrg8zYS_SKggPNwK4vaqI.woff"
anchorX="center"
anchorY="middle"
>
No Requiem
</Text>
</Suspense> </Suspense>
{computerPositions.map((computer, index) => (
<Computer
key={index}
position={computer.translation}
rotation={new Euler().setFromQuaternion(
new Quaternion().fromArray(computer.rotation),
)}
/>
))}
<Users />
<Effects />
<Controls /> <Controls />
</> </>

@ -27,7 +27,6 @@ const cloneGltf = (gltf) => {
} }
}) })
// eslint-disable-next-line no-restricted-syntax
for (const name in skinnedMeshes) { for (const name in skinnedMeshes) {
if (name) { if (name) {
const skinnedMesh = skinnedMeshes[name] const skinnedMesh = skinnedMeshes[name]

@ -17,6 +17,8 @@ import { HEIGHT } from '../Player'
import api, { State, Transform } from '../../store' import api, { State, Transform } from '../../store'
import { Color } from 'three/src/math/Color' import { Color } from 'three/src/math/Color'
import { MeshNormalMaterial } from 'three/src/materials/MeshNormalMaterial' import { MeshNormalMaterial } from 'three/src/materials/MeshNormalMaterial'
import { Object3D } from 'three/src/core/Object3D'
import { SkinnedMesh } from 'three/src/objects/SkinnedMesh'
type GLTFResult = GLTF & { type GLTFResult = GLTF & {
nodes: { nodes: {
@ -51,11 +53,12 @@ const Human: React.FC<JSX.IntrinsicElements['group'] & { id: number }> = ({
const gltf = useGLTF('/model/human.glb') as GLTFResult const gltf = useGLTF('/model/human.glb') as GLTFResult
const currentAnimation = useRef<ActionName>('idle') const currentAnimation = useRef<ActionName>('idle')
const { scene, animations } = cloneGltf(gltf) const { scene, animations } = cloneGltf(gltf as GLTFResult)
const [nodes] = useState(() => { const [nodes] = useState<Record<string, SkinnedMesh[]>>(() => {
const n = {} const n = {}
scene.children[0].children.forEach((child) => { scene.children[0].children.forEach((child: Object3D) => {
//@ts-ignore
n[child.name] = child n[child.name] = child
}) })
return n return n
@ -88,11 +91,12 @@ const Human: React.FC<JSX.IntrinsicElements['group'] & { id: number }> = ({
}, []) }, [])
const actions = useRef<GLTFActions>() const actions = useRef<GLTFActions>()
//@ts-ignore
const [mixer] = useState(() => new THREE.AnimationMixer(nodes.mesh)) const [mixer] = useState(() => new THREE.AnimationMixer(nodes.mesh))
useEffect(() => { useEffect(() => {
api.subscribe( api.subscribe(
(state: Transform | null) => { (state: Transform | undefined | null) => {
if (!state || !actions.current) { if (!state || !actions.current) {
return return
} }
@ -107,7 +111,7 @@ const Human: React.FC<JSX.IntrinsicElements['group'] & { id: number }> = ({
previousAction.crossFadeTo(newAction, 0.2, true) previousAction.crossFadeTo(newAction, 0.2, true)
currentAnimation.current = state.animation currentAnimation.current = state.animation
}, },
(state) => state.userTransforms[id], (state) => state?.userTransforms?.[id],
) )
}, [id]) }, [id])
@ -158,8 +162,8 @@ const Human: React.FC<JSX.IntrinsicElements['group'] & { id: number }> = ({
<group name="root" rotation={[0, -0.09, 0]}> <group name="root" rotation={[0, -0.09, 0]}>
<primitive object={nodes.mixamorigHips} /> <primitive object={nodes.mixamorigHips} />
<skinnedMesh <skinnedMesh
material={material} material={material} //@ts-ignore
geometry={nodes.mesh.geometry} geometry={nodes.mesh.geometry} //@ts-ignore
skeleton={nodes.mesh.skeleton} skeleton={nodes.mesh.skeleton}
></skinnedMesh> ></skinnedMesh>
</group> </group>

Loading…
Cancel
Save