GithubHelp home page GithubHelp logo

Issues with react hooks about gltfjsx HOT 5 CLOSED

pmndrs avatar pmndrs commented on July 21, 2024
Issues with react hooks

from gltfjsx.

Comments (5)

gsimone avatar gsimone commented on July 21, 2024 1

It happens don't worry!

image

from gltfjsx.

gsimone avatar gsimone commented on July 21, 2024

Can you share the code? It might be a couple of reasons. Follow the link that comes with the error to read more

https://reactjs.org/warnings/invalid-hook-call-warning.html

from gltfjsx.

sean-hale-dev avatar sean-hale-dev commented on July 21, 2024

Here's the code, I'd read the page the error page linked but no dice as far as I can tell.

App.js

import React, { Suspense } from "react";
import { Canvas } from "react-three-fiber";
import { OrbitControls } from "@react-three/drei"
import './App.css';
import Kick from "./Kick"

function App() {
        return (
                <Canvas>
                  <OrbitControls />
                  <ambientLight intensity={0.6} />
                  <directionalLight intensity={0.5} />
                  <Suspense fallback={null}>
                        <Kick />
                  </Suspense>
                </Canvas>
        )
}

export default App;

Kick.js

/*
Auto-generated by: https://github.com/pmndrs/gltfjsx
*/

import React, { useRef } from "react";
import { useGLTF } from "@react-three/drei/core/useGLTF";

export default function Model(props) {
  const group = useRef();
  const { nodes, materials } = useGLTF("/kick.glb");
  return (
    <group ref={group} {...props} dispose={null}>
      <group rotation={[Math.PI / 2, 0, 0]} scale={[0.01, 0.01, 0.01]}>
        <primitive object={nodes.mixamorigHips} />
        <skinnedMesh
          material={materials.Ch03_Body}
          geometry={nodes.Ch03.geometry}
          skeleton={nodes.Ch03.skeleton}
        />
      </group>
    </group>
  );
}

useGLTF.preload("/kick.glb");

NPM Installed packages

[email protected] /Users/west/Documents/CodeProjects/Websites/model-loader
├── @testing-library/[email protected]
├── @testing-library/[email protected]
├── @testing-library/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

React version check

[email protected] /Users/west/Documents/CodeProjects/Websites/model-loader
├─┬ @testing-library/[email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├── [email protected] deduped
│ └─┬ [email protected]
│   └── [email protected] deduped
└── [email protected]

from gltfjsx.

gsimone avatar gsimone commented on July 21, 2024

Can you try installing @react-three/drei ?

from gltfjsx.

sean-hale-dev avatar sean-hale-dev commented on July 21, 2024

I cannot believe I just forgot a package. Sorry to waste time, looks like this all works now.

from gltfjsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.