add client side terrain without collision
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
||||
import * as THREE from 'three'
|
||||
import { Vector2 } from 'three'
|
||||
import SAT from 'sat'
|
||||
import SATX from './satx.js'
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class Entity {
|
||||
speed = 400
|
||||
radius = 0
|
||||
|
||||
#position = new THREE.Vector2(0, 0)
|
||||
#position = new Vector2()
|
||||
#dest = null
|
||||
#game = null
|
||||
|
||||
@@ -40,7 +40,7 @@ export default class Entity {
|
||||
}
|
||||
|
||||
moveAction(x, y) {
|
||||
this.#dest = new THREE.Vector3(x, y, 0)
|
||||
this.#dest = new Vector2(x, y)
|
||||
}
|
||||
|
||||
state() {
|
||||
@@ -60,7 +60,7 @@ export default class Entity {
|
||||
takeStep() {
|
||||
const speed = this.speed / (this.game?.tickBudget ?? 1000)
|
||||
if (this.#dest != null) {
|
||||
const fixedDest = new THREE.Vector2(
|
||||
const fixedDest = new Vector2(
|
||||
Math.min(Math.max(this.radius, this.#dest.x), (this.game?.width ?? Infinity) - this.radius),
|
||||
Math.min(Math.max(this.radius, this.#dest.y), (this.game?.height ?? Infinity) - this.radius),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user