cutechicken commited on
Commit
a915f93
·
verified ·
1 Parent(s): 6ed5450

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +15 -15
game.js CHANGED
@@ -673,25 +673,25 @@ class Enemy {
673
 
674
  // 조준 시스템
675
  updateAiming(playerPosition) {
676
- const targetDirection = new THREE.Vector3()
677
- .subVectors(playerPosition, this.mesh.position)
678
- .normalize();
679
 
680
- // 목표 회전각 계산
681
- this.aiState.targetRotation = Math.atan2(targetDirection.x, targetDirection.z);
682
 
683
- // 현재 회전각 부드럽게 조정
684
- const rotationDiff = this.aiState.targetRotation - this.aiState.currentRotation;
685
- let rotationStep = Math.sign(rotationDiff) * Math.min(Math.abs(rotationDiff), 0.05);
686
- this.aiState.currentRotation += rotationStep;
687
 
688
- // 메시 회전 적용
689
- this.mesh.rotation.y = this.aiState.currentRotation;
690
 
691
- // 조준 정확도 계산
692
- const aimAccuracy = 1 - Math.abs(rotationDiff) / Math.PI;
693
- return aimAccuracy > this.combat.aimThreshold;
694
- }
695
 
696
  // 전투 거리 관리
697
  maintainCombatDistance(playerPosition) {
 
673
 
674
  // 조준 시스템
675
  updateAiming(playerPosition) {
676
+ const targetDirection = new THREE.Vector3()
677
+ .subVectors(playerPosition, this.mesh.position)
678
+ .normalize();
679
 
680
+ // 목표 회전각 계산
681
+ this.aiState.targetRotation = Math.atan2(targetDirection.x, targetDirection.z);
682
 
683
+ // 현재 회전각 부드럽게 조정 - 선회 속도를 느리게 하기 위해 조정
684
+ const rotationDiff = this.aiState.targetRotation - this.aiState.currentRotation;
685
+ let rotationStep = Math.sign(rotationDiff) * Math.min(Math.abs(rotationDiff), 0.02); // 기존 0.05에서 0.02로 수정
686
+ this.aiState.currentRotation += rotationStep;
687
 
688
+ // 메시 회전 적용
689
+ this.mesh.rotation.y = this.aiState.currentRotation;
690
 
691
+ // 조준 정확도 계산
692
+ const aimAccuracy = 1 - Math.abs(rotationDiff) / Math.PI;
693
+ return aimAccuracy > this.combat.aimThreshold;
694
+ }
695
 
696
  // 전투 거리 관리
697
  maintainCombatDistance(playerPosition) {