death camera mostly working
This commit is contained in:
@@ -16,19 +16,20 @@ func _process(delta):
|
||||
|
||||
#calculate move position for each child
|
||||
for i in minions:
|
||||
#by number of minions determine the amount they should rotate around the player to be evenly distributed
|
||||
number_minions = minions.size()
|
||||
|
||||
#return current array index
|
||||
var minion_rot_amount = minions.find(i) * deg_to_rad(360 / number_minions)
|
||||
var player_pos = i.player.global_transform.origin
|
||||
var minion_pos = player_pos + Vector3(4,0,0)
|
||||
var nav_pos : Vector3
|
||||
|
||||
nav_pos.x = player_pos.x + (minion_pos.x-player_pos.x)*cos(minion_rot_amount) - (minion_pos.z-player_pos.z)*sin(minion_rot_amount)
|
||||
nav_pos.z = player_pos.z + (minion_pos.x-player_pos.x)*sin(minion_rot_amount) - (minion_pos.z-player_pos.z)*cos(minion_rot_amount)
|
||||
|
||||
i.nav_agent.set_target_position(nav_pos)
|
||||
var next_nav_point = i.nav_agent.get_next_path_position()
|
||||
|
||||
i.hive_velocity = (next_nav_point - i.global_transform.origin).normalized() * i.SPEED
|
||||
if i.player != null:
|
||||
#by number of minions determine the amount they should rotate around the player to be evenly distributed
|
||||
number_minions = minions.size()
|
||||
|
||||
#return current array index
|
||||
var minion_rot_amount = minions.find(i) * deg_to_rad(360 / number_minions)
|
||||
var player_pos = i.player.global_transform.origin
|
||||
var minion_pos = player_pos + Vector3(4,0,0)
|
||||
var nav_pos : Vector3
|
||||
|
||||
nav_pos.x = player_pos.x + (minion_pos.x-player_pos.x)*cos(minion_rot_amount) - (minion_pos.z-player_pos.z)*sin(minion_rot_amount)
|
||||
nav_pos.z = player_pos.z + (minion_pos.x-player_pos.x)*sin(minion_rot_amount) - (minion_pos.z-player_pos.z)*cos(minion_rot_amount)
|
||||
|
||||
i.nav_agent.set_target_position(nav_pos)
|
||||
var next_nav_point = i.nav_agent.get_next_path_position()
|
||||
|
||||
i.hive_velocity = (next_nav_point - i.global_transform.origin).normalized() * i.SPEED
|
||||
|
||||
Reference in New Issue
Block a user