From 9314a8b06f696a18da62daa7f49ebaaa17c9c40b Mon Sep 17 00:00:00 2001 From: Ian Mancini Date: Sat, 12 Dec 2020 01:22:50 -0300 Subject: [PATCH] Fix build (bypass typescript) --- packages/client/src/3d/index.tsx | 85 +------------------ .../src/3d/lib/{cloneGltf.ts => cloneGltf.js} | 1 - packages/client/src/3d/models/Human.tsx | 18 ++-- 3 files changed, 14 insertions(+), 90 deletions(-) rename packages/client/src/3d/lib/{cloneGltf.ts => cloneGltf.js} (95%) diff --git a/packages/client/src/3d/index.tsx b/packages/client/src/3d/index.tsx index 8637cd8..27d9e8e 100644 --- a/packages/client/src/3d/index.tsx +++ b/packages/client/src/3d/index.tsx @@ -39,7 +39,7 @@ const Scene: React.FC = () => { return ( <> - + {process.env.NODE_ENV !== 'production' ? : null} @@ -68,88 +68,9 @@ const Scene: React.FC = () => { EN CONSTRUCCIÓN - - Aguyje Angirũ - - - - 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. - - - - La Traicion de la Realidad - - - - No Requiem - + + - {computerPositions.map((computer, index) => ( - - ))} - - diff --git a/packages/client/src/3d/lib/cloneGltf.ts b/packages/client/src/3d/lib/cloneGltf.js similarity index 95% rename from packages/client/src/3d/lib/cloneGltf.ts rename to packages/client/src/3d/lib/cloneGltf.js index f75bd4b..a108620 100644 --- a/packages/client/src/3d/lib/cloneGltf.ts +++ b/packages/client/src/3d/lib/cloneGltf.js @@ -27,7 +27,6 @@ const cloneGltf = (gltf) => { } }) - // eslint-disable-next-line no-restricted-syntax for (const name in skinnedMeshes) { if (name) { const skinnedMesh = skinnedMeshes[name] diff --git a/packages/client/src/3d/models/Human.tsx b/packages/client/src/3d/models/Human.tsx index 9e5efeb..2ec4954 100644 --- a/packages/client/src/3d/models/Human.tsx +++ b/packages/client/src/3d/models/Human.tsx @@ -17,6 +17,8 @@ import { HEIGHT } from '../Player' import api, { State, Transform } from '../../store' import { Color } from 'three/src/math/Color' import { MeshNormalMaterial } from 'three/src/materials/MeshNormalMaterial' +import { Object3D } from 'three/src/core/Object3D' +import { SkinnedMesh } from 'three/src/objects/SkinnedMesh' type GLTFResult = GLTF & { nodes: { @@ -51,11 +53,12 @@ const Human: React.FC = ({ const gltf = useGLTF('/model/human.glb') as GLTFResult const currentAnimation = useRef('idle') - const { scene, animations } = cloneGltf(gltf) + const { scene, animations } = cloneGltf(gltf as GLTFResult) - const [nodes] = useState(() => { + const [nodes] = useState>(() => { const n = {} - scene.children[0].children.forEach((child) => { + scene.children[0].children.forEach((child: Object3D) => { + //@ts-ignore n[child.name] = child }) return n @@ -88,11 +91,12 @@ const Human: React.FC = ({ }, []) const actions = useRef() + //@ts-ignore const [mixer] = useState(() => new THREE.AnimationMixer(nodes.mesh)) useEffect(() => { api.subscribe( - (state: Transform | null) => { + (state: Transform | undefined | null) => { if (!state || !actions.current) { return } @@ -107,7 +111,7 @@ const Human: React.FC = ({ previousAction.crossFadeTo(newAction, 0.2, true) currentAnimation.current = state.animation }, - (state) => state.userTransforms[id], + (state) => state?.userTransforms?.[id], ) }, [id]) @@ -158,8 +162,8 @@ const Human: React.FC = ({