This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import {Canvas, extend, Dom} from 'react-three-fiber' | |
| import {Physics} from 'use-cannon' | |
| import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls'; | |
| //import Scene from './render/Scene' | |
| import Controls from './render/Controls' | |
| //import BoxHover from './3d/BoxHover' | |
| import Plane from './3d/Plane' | |
| import Joueur from './3d/Joueur' | |
| //import Wall from './3d/Wall' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useFrame, useThree } from "react-three-fiber"; | |
| import store from "../store/store"; | |
| export default function Camera() { | |
| const { camera } = useThree(); | |
| useFrame(() => { | |
| camera.position !== store.getState().camera.position | |
| ? store.dispatch({ type: "CAMERA POSITION", position: camera.position }) | |
| : null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const [wheelShape, wheelApi] = useSphere(() => ({ | |
| radius: 1.2, | |
| })); | |
| const [chassisShape, chassisApi] = useBox(() => ({ | |
| args: [5, 2, 0.5], | |
| mass: 1, | |
| })); | |
| const zero = [0, 0, 0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const [wheelBody, wheelApi] = useSphere(() => ({ | |
| args : [2,2,2] | |
| })); | |
| const [wheelShapeLF, wheelApiLF] = [wheelBody, wheelApi]; | |
| const [wheelShapeRL, wheelApiRL] = [wheelBody, wheelApi]; | |
| const [wheelShapeRF, wheelApiRF] = [wheelBody, wheelApi]; | |
| const [wheelShapeRR, wheelApiRR] = [wheelBody, wheelApi]; |
OlderNewer