proto3 initial commit
This commit is contained in:
19
proto3/godot/ai/has_arrived.gd
Normal file
19
proto3/godot/ai/has_arrived.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends BTCondition
|
||||
class_name BTHasArrived
|
||||
|
||||
func tick(tick: Tick) -> int:
|
||||
var npc = tick.actor
|
||||
var tgt = npc.get_meta("target_loc")
|
||||
var point = npc.get_meta("path_point")
|
||||
var npc_pos = npc.global_transform.origin
|
||||
# print("target: ", tgt, " point: ", point, " pos: ", npc_pos)
|
||||
if point.distance_to(tgt) < 0.2:
|
||||
# print("arrived1")
|
||||
npc.set_meta("path_valid", 0.0)
|
||||
return OK
|
||||
if npc_pos.distance_to(tgt) < 0.4:
|
||||
# print("arrived2")
|
||||
npc.set_meta("path_valid", 0.0)
|
||||
return OK
|
||||
# print(npc.name, " distance: ", npc_pos.distance_to(tgt))
|
||||
return FAILED
|
||||
Reference in New Issue
Block a user