idle works with avoidance
This commit is contained in:
@@ -66,10 +66,15 @@ func rotate_to_face2D(object,target,target_offset_angle,delta,turn_speed):
|
||||
func move_to_nav_point(delta):
|
||||
var destination = enemy.nav_agent.get_next_path_position()
|
||||
var local_destination = destination - enemy.global_position
|
||||
var direction = local_destination.normalized()
|
||||
enemy.velocity = direction * move_speed
|
||||
var new_velocity = local_destination.normalized() * move_speed
|
||||
|
||||
enemy.nav_agent.set_velocity(new_velocity)
|
||||
enemy.global_rotation.y = rotate_to_face2D(enemy,destination,0,delta,body_turn_speed)
|
||||
|
||||
func velocity_computed(safe_velocity):
|
||||
enemy.velocity = enemy.velocity.move_toward(safe_velocity,.25)
|
||||
|
||||
|
||||
func turret_look(target,delta):
|
||||
enemy.turret_look.global_rotation.y = rotate_to_face2D(enemy.turret_look,target,0,delta,turret_speed)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user