Skip to content

Commit 71c9304

Browse files
committed
Update example to remove usage of second process function
1 parent 391a9c7 commit 71c9304

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

extension/src/ai_blue_agent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bool AIBlueAgent::agent_setup(Variant agentNode)
4141
}
4242
}
4343

44-
void AIBlueAgent::_process(double _delta)
44+
void AIBlueAgent::_physics_process(double _delta)
4545
{
4646
if (_domain.Root()->Name() != "DefaultDomainName")
4747
{

extension/src/ai_blue_agent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class AIBlueAgent : public Node3D
3636
bool agent_setup(Variant agentNode);
3737
void planner_tick();
3838

39-
void _process(double delta) override;
39+
void _physics_process(double delta) override;
4040

4141
/**
4242
* Sensors

game/controller/agent/AgentController.gd

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ const SPEED = 3.0
66

77
func _ready():
88
$AIBlueAgent.agent_setup(self.get_path())
9-
func _process(_delta):
10-
var current_location = global_transform.origin
11-
var next_location = nav_agent.get_next_location()
12-
var new_velocity = (next_location - current_location).normalized() * SPEED
13-
14-
velocity = new_velocity
15-
move_and_slide()
169

1710
func update_target_loc(target_loc):
1811
nav_agent.set_target_location(target_loc)
@@ -35,6 +28,12 @@ func _on_vision_sensor_timeout():
3528

3629
func moveTo() -> bool:
3730
#print("Move Agent To Location")
31+
var current_location = global_transform.origin
32+
var next_location = nav_agent.get_next_location()
33+
var new_velocity = (next_location - current_location).normalized() * SPEED
34+
35+
velocity = new_velocity
36+
move_and_slide()
3837
return true;
3938

4039
func closest_player() -> Vector3:

0 commit comments

Comments
 (0)