2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 13:36:30 +01:00
|
|
|
#include "gsai_specialized_agent.h"
|
|
|
|
|
|
|
|
#include "../gsai_target_acceleration.h"
|
2023-01-13 21:13:57 +01:00
|
|
|
|
|
|
|
bool GSAISpecializedAgent::get_calculate_velocities() const {
|
2023-01-13 21:35:07 +01:00
|
|
|
return calculate_velocities;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GSAISpecializedAgent::set_calculate_velocities(const bool val) {
|
2023-01-13 21:35:07 +01:00
|
|
|
calculate_velocities = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool GSAISpecializedAgent::get_apply_linear_drag() const {
|
2023-01-13 21:35:07 +01:00
|
|
|
return apply_linear_drag;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GSAISpecializedAgent::set_apply_linear_drag(const bool val) {
|
2023-01-13 21:35:07 +01:00
|
|
|
apply_linear_drag = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool GSAISpecializedAgent::get_apply_angular_drag() const {
|
2023-01-13 21:35:07 +01:00
|
|
|
return apply_angular_drag;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GSAISpecializedAgent::set_apply_angular_drag(const bool val) {
|
2023-01-13 21:35:07 +01:00
|
|
|
apply_angular_drag = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
float GSAISpecializedAgent::get_linear_drag_percentage() const {
|
2023-01-13 21:35:07 +01:00
|
|
|
return linear_drag_percentage;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GSAISpecializedAgent::set_linear_drag_percentage(const float val) {
|
2023-01-13 21:35:07 +01:00
|
|
|
linear_drag_percentage = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
float GSAISpecializedAgent::get_angular_drag_percentage() const {
|
2023-01-13 21:35:07 +01:00
|
|
|
return angular_drag_percentage;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GSAISpecializedAgent::set_angular_drag_percentage(const float val) {
|
2023-01-13 21:35:07 +01:00
|
|
|
angular_drag_percentage = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
float GSAISpecializedAgent::get_last_orientation() const {
|
2023-01-13 21:35:07 +01:00
|
|
|
return last_orientation;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GSAISpecializedAgent::set_last_orientation(const float val) {
|
2023-01-13 21:35:07 +01:00
|
|
|
last_orientation = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool GSAISpecializedAgent::get_applied_steering() const {
|
2023-01-13 21:35:07 +01:00
|
|
|
return applied_steering;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GSAISpecializedAgent::set_applied_steering(const bool val) {
|
2023-01-13 21:35:07 +01:00
|
|
|
applied_steering = val;
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-14 13:36:30 +01:00
|
|
|
void GSAISpecializedAgent::apply_steering(const Ref<GSAITargetAcceleration> &acceleration, const float delta) {
|
|
|
|
call("_apply_steering", acceleration, delta);
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
2023-01-14 13:36:30 +01:00
|
|
|
|
|
|
|
void GSAISpecializedAgent::_apply_steering(Ref<GSAITargetAcceleration> acceleration, float delta) {
|
2023-01-13 21:13:57 +01:00
|
|
|
}
|
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
GSAISpecializedAgent::GSAISpecializedAgent() {
|
|
|
|
calculate_velocities = true;
|
|
|
|
apply_linear_drag = true;
|
|
|
|
apply_angular_drag = true;
|
|
|
|
linear_drag_percentage = 0.0;
|
|
|
|
angular_drag_percentage = 0.0;
|
|
|
|
last_orientation = 0.0;
|
|
|
|
applied_steering = false;
|
|
|
|
}
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
GSAISpecializedAgent::~GSAISpecializedAgent() {
|
|
|
|
}
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 13:36:30 +01:00
|
|
|
void GSAISpecializedAgent::_bind_methods() {
|
2023-01-13 21:35:07 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_calculate_velocities"), &GSAISpecializedAgent::get_calculate_velocities);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_calculate_velocities", "value"), &GSAISpecializedAgent::set_calculate_velocities);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "calculate_velocities"), "set_calculate_velocities", "get_calculate_velocities");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_apply_linear_drag"), &GSAISpecializedAgent::get_apply_linear_drag);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_apply_linear_drag", "value"), &GSAISpecializedAgent::set_apply_linear_drag);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "apply_linear_drag"), "set_apply_linear_drag", "get_apply_linear_drag");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_apply_angular_drag"), &GSAISpecializedAgent::get_apply_angular_drag);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_apply_angular_drag", "value"), &GSAISpecializedAgent::set_apply_angular_drag);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "apply_angular_drag"), "set_apply_angular_drag", "get_apply_angular_drag");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_linear_drag_percentage"), &GSAISpecializedAgent::get_linear_drag_percentage);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_linear_drag_percentage", "value"), &GSAISpecializedAgent::set_linear_drag_percentage);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "linear_drag_percentage"), "set_linear_drag_percentage", "get_linear_drag_percentage");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_angular_drag_percentage"), &GSAISpecializedAgent::get_angular_drag_percentage);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_angular_drag_percentage", "value"), &GSAISpecializedAgent::set_angular_drag_percentage);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_drag_percentage"), "set_angular_drag_percentage", "get_angular_drag_percentage");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_last_orientation"), &GSAISpecializedAgent::get_last_orientation);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_last_orientation", "value"), &GSAISpecializedAgent::set_last_orientation);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "last_orientation"), "set_last_orientation", "get_last_orientation");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_applied_steering"), &GSAISpecializedAgent::get_applied_steering);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_applied_steering", "value"), &GSAISpecializedAgent::set_applied_steering);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "applied_steering"), "set_applied_steering", "get_applied_steering");
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 13:36:30 +01:00
|
|
|
BIND_VMETHOD(MethodInfo("_apply_steering", PropertyInfo(Variant::OBJECT, "acceleration", PROPERTY_HINT_RESOURCE_TYPE, "GSAITargetAcceleration"), PropertyInfo(Variant::REAL, "delta")));
|
|
|
|
ClassDB::bind_method(D_METHOD("apply_steering", "acceleration", "delta"), &GSAISpecializedAgent::apply_steering);
|
|
|
|
ClassDB::bind_method(D_METHOD("_apply_steering", "acceleration", "delta"), &GSAISpecializedAgent::_apply_steering);
|
2023-01-13 21:35:07 +01:00
|
|
|
}
|