Skip to content
This repository was archived by the owner on Jun 24, 2023. It is now read-only.

Commit d0cc1ee

Browse files
committed
fix rapier plugin
1 parent 576fcf8 commit d0cc1ee

26 files changed

+73
-1235
lines changed

examples/create-a-game-with-r3f/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"@react-spring/core": "^9.4.4",
1111
"@react-spring/three": "^9.4.4",
1212
"@react-three/drei": "^9.46.4",
13+
"@editable-jsx/rapier": "workspace:*",
1314
"@react-three/editor": "workspace:*",
1415
"@react-three/fiber": "^8.8.9",
1516
"@types/react-reconciler": "^0.28.0",

examples/create-a-game-with-r3f/src/Experience.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import { OrbitControls } from "@react-three/drei"
22
import { EditorRoot, extendControls } from "@react-three/editor"
33
import { Physics, RigidBody } from "@react-three/rapier"
4+
import { BlockAxe } from "./components/BlockAxe.js"
5+
import { BlockEnd } from "./components/BlockEnd.js"
6+
import { BlockLimbo } from "./components/BlockLimbo.js"
7+
import { BlockSpinner } from "./components/BlockSpinner.js"
8+
import { BlockStart } from "./components/BlockStart.js"
9+
import { Bounds } from "./components/Bounds.js"
410
import Lights from "./Lights.js"
11+
import { Player } from "./Player.js"
512

613
extendControls(RigidBody, {
714
mass: { value: 1, min: 0, max: 100, step: 0.1, type: "number" },
@@ -14,14 +21,13 @@ extendControls(RigidBody, {
1421
function Level() {
1522
return (
1623
<>
17-
{/* <group></group>
1824
<BlockStart position={[0, 0.426, 0]} />
1925
<BlockLimbo position={[0, -0.003, -4]} />
2026
<BlockSpinner position={[0, 0, -8]} />
2127
<BlockSpinner position={[0, 0, -12]} />
2228
<BlockAxe position={[0, 0, -16]} />
2329
<BlockEnd position={[0.0, 0, -20]} />
24-
<Bounds length={6} name={"yo!"} /> */}
30+
<Bounds length={6} name={"yo!"} />
2531
</>
2632
)
2733
}
@@ -35,7 +41,7 @@ export default function Experience() {
3541
<Level />
3642
<Lights />
3743
</EditorRoot>
38-
{/* <Player /> */}
44+
<Player />
3945
{/* <gridHelper /> */}
4046
</Physics>
4147
</>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default function Lights() {
22
return <>
3-
<directionalLight castShadow position={[-1.389, 2.637, 0.886]} intensity={1.5} shadow-mapSize={[1024, 1024]} shadow-camera-near={1} shadow-camera-far={10} shadow-camera-top={10} shadow-camera-right={10} shadow-camera-bottom={-10} shadow-camera-left={-10} />
3+
<directionalLight castShadow position={[3.451, 4.277, -2.997]} intensity={1.5} shadow-mapSize={[1024, 1024]} shadow-camera-near={1} shadow-camera-far={10} shadow-camera-top={10} shadow-camera-right={10} shadow-camera-bottom={-10} shadow-camera-left={-10} />
44
<ambientLight intensity={0.7} position={[-1.984, 3.006, 0.5]} color={"rgb(209, 179, 140)"} />
55
</>;
66
}

examples/create-a-game-with-r3f/src/Player.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useKeyboardControls } from "@react-three/drei"
22
import { useEditor } from "@react-three/editor"
3-
import { addPlugin } from "@react-three/editor/src/fiber/plugins"
3+
import { addPlugin } from "@react-three/editor/src/plugins"
44
import { useFrame } from "@react-three/fiber"
55
import { RigidBody, RigidBodyApi, useRapier } from "@react-three/rapier"
66
import { useEffect, useRef } from "react"

examples/create-a-game-with-r3f/src/index.tsx

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import "@editable-jsx/rapier"
12
import { KeyboardControls } from "@react-three/drei"
2-
import "@react-three/editor/rapier"
33
import { Canvas } from "@react-three/fiber"
44
import ReactDOM from "react-dom/client"
5-
import { Game, store } from "./Game.js"
6-
import { ImageList } from "./Imagelist.js"
5+
import Experience from "./Experience"
76
import "./style.css"
87
const root = ReactDOM.createRoot(document.querySelector("#root"))
98

@@ -36,7 +35,21 @@ root.render(
3635
}
3736
]}
3837
>
39-
<Window>
38+
<Canvas
39+
ref={(node) => {
40+
console.log("hereee")
41+
// store.canvas = node
42+
}}
43+
camera={{
44+
fov: 45,
45+
near: 0.1,
46+
far: 200,
47+
position: [2.5, 4, 6]
48+
}}
49+
>
50+
<Experience />
51+
</Canvas>
52+
{/* <Window>
4053
<div className="App">
4154
<Canvas
4255
ref={(node) => {
@@ -54,6 +67,6 @@ root.render(
5467
</Canvas>
5568
</div>
5669
</Window>
57-
<ImageList />
70+
<ImageList /> */}
5871
</KeyboardControls>
5972
)

packages/rapier/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"module": "dist/editable-jsx-rapier.esm.js",
1212
"preconstruct": {
1313
"entrypoints": [
14-
"index.ts"
14+
"index.tsx"
1515
]
1616
},
1717
"files": [
@@ -47,6 +47,7 @@
4747
"@babel/generator": "^7.20.4",
4848
"@babel/helper-plugin-utils": "^7.20.2",
4949
"@babel/template": "^7.18.10",
50+
"@editable-jsx/editable": "workspace:^0.0.1",
5051
"@editable-jsx/state": "workspace:^0.0.1",
5152
"@editable-jsx/ui": "workspace:^0.0.1",
5253
"@iconify/react": "^4.0.1",

packages/rapier/src/PanelManager.tsx

-227
This file was deleted.

packages/rapier/src/PanelsProvider.tsx

-16
This file was deleted.

packages/rapier/src/index.ts

-18
This file was deleted.

packages/three-fiber/src/rapier.tsx packages/rapier/src/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { setEditable } from "@editable-jsx/editable"
1+
import { setEditable, useEditor } from "@editable-jsx/editable"
22
import { Debug, Physics, useRapier } from "@react-three/rapier"
33
import { useMemo } from "react"
4-
import { useEditor } from "./fiber"
54

65
setEditable(Physics, ({ children, ...props }) => {
76
const editor = useEditor()

0 commit comments

Comments
 (0)