diff --git a/packages/react-three-cannon-examples/package.json b/packages/react-three-cannon-examples/package.json
index 92b1af0f..7cab3546 100755
--- a/packages/react-three-cannon-examples/package.json
+++ b/packages/react-three-cannon-examples/package.json
@@ -21,8 +21,8 @@
],
"devDependencies": {
"@react-three/cannon": "^6.6.0",
- "@react-three/drei": "^9.80.1",
- "@react-three/fiber": "^8.13.6",
+ "@react-three/drei": "^9.97.5",
+ "@react-three/fiber": "^8.15.16",
"@types/lodash-es": "^4.17.6",
"@types/react": "^18.0.5",
"@types/react-dom": "^17.0.14",
@@ -31,7 +31,6 @@
"@types/three": "^0.155.0",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
- "@vitejs/plugin-react": "^2.2.0",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-es": "^4.1.0",
@@ -47,16 +46,17 @@
"react-router-dom": "^6.2.2",
"styled-components": "^5.3.5",
"three": "^0.155.0",
- "three-stdlib": "^2.24.1",
+ "three-stdlib": "^2.29.4",
"typescript": "^4.6.3",
- "vite": "^3.2.2",
+ "vite": "^5.1.1",
"vite-react-jsx": "^1.1.2",
- "zustand": "^3.7.1"
+ "zustand": "^4.5.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix",
"*.{js,json,jsx,md,ts,tsx}": "prettier --write"
},
"license": "MIT",
- "sideEffects": false
+ "sideEffects": false,
+ "type": "module"
}
diff --git a/packages/react-three-cannon-examples/src/demos/MondayMorning/index.tsx b/packages/react-three-cannon-examples/src/demos/MondayMorning/index.tsx
index 1d791c9e..2d036fa1 100644
--- a/packages/react-three-cannon-examples/src/demos/MondayMorning/index.tsx
+++ b/packages/react-three-cannon-examples/src/demos/MondayMorning/index.tsx
@@ -9,8 +9,9 @@ import {
usePointToPointConstraint,
useSphere,
} from '@react-three/cannon'
+import { useGLTF } from '@react-three/drei'
import type { BoxGeometryProps, MeshProps, MeshStandardMaterialProps, ThreeEvent } from '@react-three/fiber'
-import { Canvas, useFrame, useLoader } from '@react-three/fiber'
+import { Canvas, useFrame } from '@react-three/fiber'
import type { ReactNode, RefObject } from 'react'
import {
createContext,
@@ -25,7 +26,6 @@ import {
} from 'react'
import type { Group, Material, Mesh, Object3D, SpotLight } from 'three'
import type { GLTF } from 'three-stdlib/loaders/GLTFLoader'
-import { GLTFLoader } from 'three-stdlib/loaders/GLTFLoader'
import type { ShapeName } from './createConfig'
import { createRagdoll } from './createConfig'
@@ -206,7 +206,7 @@ interface CupGLTF extends GLTF {
}
function Mug() {
- const { nodes, materials } = useLoader(GLTFLoader, '/cup.glb') as CupGLTF
+ const { nodes, materials } = useGLTF('/cup.glb') as CupGLTF
const [ref] = useCylinder(
() => ({
args: [0.6, 0.6, 1, 16],
@@ -292,8 +292,16 @@ const Lamp = () => {
-
-
+
+
>
)
@@ -322,15 +330,11 @@ export default () => (
orthographic
shadows
style={{ cursor: 'none' }}
- gl={{
- // todo: stop using legacy lights
- useLegacyLights: true,
- }}
>
-
-
+
+
diff --git a/packages/react-three-cannon-examples/src/demos/Pingpong/index.tsx b/packages/react-three-cannon-examples/src/demos/Pingpong/index.tsx
index 3ee14937..931ca577 100644
--- a/packages/react-three-cannon-examples/src/demos/Pingpong/index.tsx
+++ b/packages/react-three-cannon-examples/src/demos/Pingpong/index.tsx
@@ -1,14 +1,13 @@
import { Physics, useBox, usePlane, useSphere } from '@react-three/cannon'
+import { useGLTF } from '@react-three/drei'
import { Canvas, useFrame, useLoader } from '@react-three/fiber'
import lerp from 'lerp'
import clamp from 'lodash-es/clamp'
import { Suspense, useRef } from 'react'
import type { Group, Material, Mesh, Object3D, Skeleton } from 'three'
import { TextureLoader } from 'three'
-import { DRACOLoader } from 'three-stdlib/loaders/DRACOLoader'
import type { GLTF } from 'three-stdlib/loaders/GLTFLoader'
-import { GLTFLoader } from 'three-stdlib/loaders/GLTFLoader'
-import create from 'zustand'
+import { create } from 'zustand'
import earthImg from './resources/cross.jpg'
import pingSound from './resources/ping.mp3'
@@ -46,14 +45,8 @@ type PingPongGLTF = GLTF & {
}
}
-const extensions = (loader: GLTFLoader) => {
- const dracoLoader = new DRACOLoader()
- dracoLoader.setDecoderPath('/draco-gltf/')
- loader.setDRACOLoader(dracoLoader)
-}
-
function Paddle() {
- const { nodes, materials } = useLoader(GLTFLoader, '/pingpong.glb', extensions) as PingPongGLTF
+ const { nodes, materials } = useGLTF('/pingpong.glb', '/draco-gltf/') as PingPongGLTF
const { pong } = useStore((state) => state.api)
const welcome = useStore((state) => state.welcome)
const count = useStore((state) => state.count)
@@ -149,23 +142,20 @@ export default function () {
return (
<>