mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-28 06:37:11 +01:00
24 lines
541 B
C++
24 lines
541 B
C++
|
|
#include "gsai_flee.h"
|
|
|
|
#include "../gsai_agent_location.h"
|
|
#include "../gsai_steering_agent.h"
|
|
#include "../gsai_target_acceleration.h"
|
|
|
|
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);
|
|
}
|
|
|
|
GSAIFlee::GSAIFlee() {
|
|
}
|
|
|
|
GSAIFlee::~GSAIFlee() {
|
|
}
|
|
|
|
void GSAIFlee::_bind_methods() {
|
|
}
|