adjust visual height

This commit is contained in:
2025-01-12 20:05:29 +09:00
parent 8e861929cb
commit ea23aa3174
4 changed files with 8 additions and 6 deletions
+4 -4
View File
@@ -172,7 +172,7 @@ function connectWebSocket() {
entity = entities[e.id]
}
else {
entity = new THREE.Mesh(new THREE.CylinderGeometry(e.radius / 100, e.radius / 100, e.radius / 50), entityMaterial)
entity = new THREE.Mesh(new THREE.CylinderGeometry(e.radius / 100, e.radius / 100, e.height / 50), entityMaterial)
entity.rotation.x = Math.PI / 2
entity.userData.type = 'entity'
entity.userData.id = e.id
@@ -183,7 +183,7 @@ function connectWebSocket() {
const hpMargin = 0.4
const maxHp = new THREE.Sprite(new THREE.SpriteMaterial({ color: 0xd03333 }))
maxHp.position.set(0, (e.radius / 100) + hpMargin, 0)
maxHp.position.set(0, (e.height / 100) + hpMargin, 0)
maxHp.scale.set(1.5, 0.2, 1)
maxHp.layers.set(1)
entity.add(maxHp)
@@ -227,7 +227,7 @@ function connectWebSocket() {
projectile = new THREE.Mesh(new THREE.SphereGeometry(p.radius / 100), projectileMaterial)
projectile.userData.type = 'projectile'
projectile.userData.id = p.id
projectile.position.set(p.position.x / 100, p.position.y / 100, p.visualHeight / 100)
projectile.position.set(p.position.x / 100, p.position.y / 100, p.height / 100)
projectile.layers.set(2)
scene.add(projectile)
@@ -235,7 +235,7 @@ function connectWebSocket() {
}
projectile.userData.flaggedForRemoval = false
positionTweens[projectile.id] = new Tween(projectile.position).to({ x: p.position.x / 100, y: p.position.y / 100, z: p.visualHeight / 100 }, tweenDuration).start()
positionTweens[projectile.id] = new Tween(projectile.position).to({ x: p.position.x / 100, y: p.position.y / 100, z: p.height / 100 }, tweenDuration).start()
}
for (const p of Object.values(projectiles)) {