tweaks to enemy idle, still getting the turret looking dialed in

This commit is contained in:
derek
2025-04-22 16:40:25 -05:00
parent 6217725c19
commit 53ce4e401f
4 changed files with 7 additions and 10 deletions

View File

@@ -372,7 +372,6 @@ transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0,
collision_layer = 32 collision_layer = 32
collision_mask = 109 collision_mask = 109
mass = 45.0 mass = 45.0
center_of_mass_mode = 1
continuous_cd = true continuous_cd = true
script = ExtResource("1_0qjnf") script = ExtResource("1_0qjnf")
weapon_drops = Array[Resource]([ExtResource("2_fw6eu"), ExtResource("3_vrqjr"), ExtResource("4_45tks"), ExtResource("5_koj0g"), ExtResource("6_plk4s"), ExtResource("7_t1qyn")]) weapon_drops = Array[Resource]([ExtResource("2_fw6eu"), ExtResource("3_vrqjr"), ExtResource("4_45tks"), ExtResource("5_koj0g"), ExtResource("6_plk4s"), ExtResource("7_t1qyn")])

View File

@@ -12,7 +12,7 @@ config_version=5
config/name="First Person Test" config/name="First Person Test"
config/tags=PackedStringArray("fps") config/tags=PackedStringArray("fps")
run/main_scene="uid://f7e0v1r6ra6c" run/main_scene="uid://bk4pn4k7n51ux"
config/features=PackedStringArray("4.4", "Forward Plus") config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="uid://6svuq1l83al5" config/icon="uid://6svuq1l83al5"

View File

@@ -10,7 +10,8 @@ var wander_time : float
var scan_time : float var scan_time : float
const WANDER_AMT = 50 const WANDER_AMT = 50
const TURRET_TURN_AMT : float = 180.0 const TURRET_TURN_AMT : float = 90.0
const TURRET_SCAN_SPEED : float = .5
func randomize_wander(): func randomize_wander():
var x = randf_range(-WANDER_AMT,WANDER_AMT) var x = randf_range(-WANDER_AMT,WANDER_AMT)
@@ -21,11 +22,13 @@ func randomize_wander():
func randomize_turret_scan(): func randomize_turret_scan():
scan_direction = -scan_direction scan_direction = -scan_direction
enemy.turret_look_next.rotation = Vector3(0,scan_direction,0)
scan_time = randf_range(5,10)
func Enter(): func Enter():
super() super()
randomize_wander() randomize_wander()
scan_direction = TURRET_TURN_AMT scan_direction = deg_to_rad(TURRET_TURN_AMT)
func Update(delta: float): func Update(delta: float):
if wander_time > 0: if wander_time > 0:
@@ -41,8 +44,7 @@ func Update(delta: float):
func Physics_Update(delta : float): func Physics_Update(delta : float):
if enemy: if enemy:
#turret transform #turret transform
enemy.turret_look_next.rotation = Vector3(0,scan_direction,0) enemy.turret_look.rotation = lerp(enemy.turret_look.rotation,enemy.turret_look_next.rotation,delta * TURRET_SCAN_SPEED)
enemy.turret_look.rotation = lerp(enemy.turret_look.rotation,enemy.turret_look_next.rotation,delta * enemy.turret_look_speed)
var destination = enemy.nav_agent.get_next_path_position() var destination = enemy.nav_agent.get_next_path_position()
var local_destination = destination - enemy.global_position var local_destination = destination - enemy.global_position

View File

@@ -89,10 +89,6 @@ func _ready():
func _process(delta): func _process(delta):
move_and_slide() move_and_slide()
turret_current_moving_speed = (turret_look_next.rotation - turret_look.rotation).length()
#if turret_current_moving_speed > 1:
#servo_single.play()
func stun(): func stun():
state_machine.on_child_transition(state_machine.current_state,"stunned") state_machine.on_child_transition(state_machine.current_state,"stunned")