ditch THREE raycasting for SAT again

This commit is contained in:
2024-12-23 09:46:26 +09:00
parent 054d22d01a
commit e23978ea90
6 changed files with 61 additions and 29 deletions
+1 -6
View File
@@ -1,5 +1,4 @@
import * as THREE from 'three'
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'
const global = (0,eval)("this")
const scene = new THREE.Scene()
@@ -23,16 +22,12 @@ directionalLight.position.set(-0.3, 0.1, 1)
directionalLight.power = 3000
scene.add(directionalLight)
// const loader = new GLTFLoader()
// loader.load('player.gltf', (gltf) => scene.add(gltf.scene), undefined, (err) => console.log(err))
global.THREE = THREE
global.renderer = renderer
global.camera = camera
global.scene = scene
camera.position.set(3, -12, 10)
camera.rotation.set((60 / 180) * Math.PI, 0, 0)
// camera.lookAt(0, 0, 0)
function animate() {
renderer.render(scene, camera)
@@ -81,7 +76,7 @@ function connectWebSocket() {
entities[e.id] = entity
}
entity.position.set(e.pos.x / 100, e.pos.y / 100, e.radius / 100)
entity.position.set(e.position.x / 100, e.position.y / 100, e.radius / 100)
}
document.getElementById('state').innerHTML = JSON.stringify(state, null, 2)