2023-01-13 22:04:30 +01:00
|
|
|
#ifndef GSAI_AVOID_COLLISIONS_H
|
|
|
|
#define GSAI_AVOID_COLLISIONS_H
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 02:31:42 +01:00
|
|
|
#include "core/object/reference.h"
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 02:31:42 +01:00
|
|
|
#include "../gsai_group_behavior.h"
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 02:31:42 +01:00
|
|
|
class GSAITargetAcceleration;
|
|
|
|
class GSAISteeringAgent;
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 02:31:42 +01:00
|
|
|
class GSAIAvoidCollisions : public GSAIGroupBehavior {
|
|
|
|
GDCLASS(GSAIAvoidCollisions, GSAIGroupBehavior);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-14 02:31:42 +01:00
|
|
|
public:
|
|
|
|
void _calculate_steering(Ref<GSAITargetAcceleration> acceleration);
|
|
|
|
bool _report_neighbor(Ref<GSAISteeringAgent> neighbor);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
GSAIAvoidCollisions();
|
|
|
|
~GSAIAvoidCollisions();
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
// Steers the agent to avoid obstacles in its path. Approximates obstacles as
|
|
|
|
// spheres.
|
|
|
|
// @category - Group behaviors
|
2023-01-14 02:31:42 +01:00
|
|
|
Ref<GSAISteeringAgent> _first_neighbor;
|
|
|
|
float _shortest_time;
|
|
|
|
float _first_minimum_separation;
|
|
|
|
float _first_distance;
|
|
|
|
Vector3 _first_relative_position;
|
|
|
|
Vector3 _first_relative_velocity;
|
2023-01-13 21:13:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|