summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-04-06 00:43:40 +0200
committerAki <please@ignore.pl>2021-04-06 00:43:40 +0200
commit7492bf4f259a5ea8b1e0994a39fb6f5db2f17426 (patch)
treeb35f54b18262a8bf1491a22554f231446d8be68e
parent37a4c3286fb2a62a4946a85b7fc771d16a2491e6 (diff)
downloadderelict-prototype-7492bf4f259a5ea8b1e0994a39fb6f5db2f17426.zip
derelict-prototype-7492bf4f259a5ea8b1e0994a39fb6f5db2f17426.tar.gz
derelict-prototype-7492bf4f259a5ea8b1e0994a39fb6f5db2f17426.tar.bz2
Added more camera movements
-rw-r--r--derelict.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/derelict.js b/derelict.js
index abe960c..65acb7c 100644
--- a/derelict.js
+++ b/derelict.js
@@ -23,6 +23,8 @@ class SkirmishGrid {
this.controls = new OrbitControls(this.camera, this.renderer2d.domElement)
this.controls.minDistance = 2
this.controls.maxDistance = 30
+ this.controls.enableDamping = true
+ this.controls.dampingFactor = 0.4
}
add(obj) {
@@ -32,6 +34,7 @@ class SkirmishGrid {
draw() {
this.renderer.render(this.scene, this.camera)
this.renderer2d.render(this.scene, this.camera)
+ this.controls.update()
requestAnimationFrame(() => this.draw())
}
@@ -48,7 +51,7 @@ class Wreck {
point = new THREE.Object3D()
killmail
- constructor({killmail, position, icon}) {
+ constructor({killmail, position, icon, grid}) {
const iconElement = document.importNode(icon, true)
const object2d = new CSS2DObject(this.domElement)
@@ -63,6 +66,10 @@ class Wreck {
this.point.add(object2d)
this.domElement.onclick = () => window.open(`https://zkillboard.com/kill/${this.killmail.killmail_id}/`)
+ this.domElement.oncontextmenu = () => {
+ grid.controls.target.copy(position)
+ grid.controls.update()
+ }
}
}
@@ -104,7 +111,7 @@ function processKillmails(grid, killmails, icon) {
const vec3 = killmail.victim.position
vec3.sub(center)
vec3.divideScalar(SCALE)
- const wreck = new Wreck({position: vec3, killmail, icon})
+ const wreck = new Wreck({position: vec3, killmail, icon, grid})
grid.add(wreck.point)
elements.push(wreck.domElement)
})