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]; |
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
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
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
const store = createStore({ | |
players : {}, | |
movement : { | |
up: false, | |
down: false, | |
left: false, | |
right: false | |
}, | |
currentId : 0, | |
score : computed(state => state.players[state.currentId].score), |
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 express = require('express'); | |
const app = express(); | |
const server = require('http').Server(app); | |
const io = require('socket.io')(server); | |
io.set('origins', '*:*'); | |
server.listen(3002); | |
const players = []; |
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 {useHotkeys} from 'react-hotkeys-hook' | |
import { useStoreState, useStoreActions, action } from 'easy-peasy'; | |
const KeyControls= (props) => { | |
const moveUP = useStoreActions(action => action.moveUP) | |
useHotkeys('up', event => { | |
if (event.type === "keydown") { | |
console.log("down"); |
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 { createStore, useStoreState, action, useStoreActions, computed } from 'easy-peasy'; | |
import React, {useEffect} from 'react'; | |
import DatGui, { DatNumber, DatString, DatBoolean} from 'react-dat-gui'; | |
import {socket} from '../Socket'; | |
const store = createStore({ | |
players : {}, | |
movement : { | |
up: false, | |
down: false, |
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
let playersList = {}; | |
listeId.map((ident, i) => { | |
playersList[ident] = { | |
score : 0, | |
x : 0, | |
y : 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
fanch@Portable:~/NandY$ npm start | |
> [email protected] start /home/fanch/NandY | |
> node ./bin/www | |
internal/modules/cjs/loader.js:583 | |
throw err; | |
^ | |
Error: Cannot find module '/home/fanch/NandY/bin/www' |
NewerOlder