Skip to content

Instantly share code, notes, and snippets.

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'
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;
const [wheelShape, wheelApi] = useSphere(() => ({
radius: 1.2,
}));
const [chassisShape, chassisApi] = useBox(() => ({
args: [5, 2, 0.5],
mass: 1,
}));
const zero = [0, 0, 0];
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];