2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:29:17 +01:00
|
|
|
#include "gsai_flee.h"
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 02:31:42 +01:00
|
|
|
#include "../gsai_agent_location.h"
|
|
|
|
#include "../gsai_steering_agent.h"
|
|
|
|
#include "../gsai_target_acceleration.h"
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 02:31:42 +01:00
|
|
|
void GSAIFlee::_calculate_steering(Ref<GSAITargetAcceleration> acceleration) {
|
|
|
|
ERR_FAIL_COND(!agent.is_valid());
|
|
|
|
ERR_FAIL_COND(!target.is_valid());
|
|
|
|
|
|
|
|
acceleration->set_linear((agent->get_position() - target->get_position()).normalized() * agent->get_linear_acceleration_max());
|
|
|
|
acceleration->set_angular(0);
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
GSAIFlee::GSAIFlee() {
|
|
|
|
}
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
GSAIFlee::~GSAIFlee() {
|
|
|
|
}
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 02:31:42 +01:00
|
|
|
void GSAIFlee::_bind_methods() {
|
2023-01-13 21:35:07 +01:00
|
|
|
}
|