2023-01-13 21:13:57 +01:00
|
|
|
#ifndef GSAIAVOIDCOLLISIONS_H
|
|
|
|
#define GSAIAVOIDCOLLISIONS_H
|
|
|
|
|
|
|
|
class GSAIAvoidCollisions : public GSAIGroupBehavior {
|
2023-01-13 21:35:07 +01:00
|
|
|
GDCLASS(GSAIAvoidCollisions, GSAIGroupBehavior);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
public:
|
|
|
|
GSAISteeringAgent get_ *_first_neighbor();
|
|
|
|
void set_ *_first_neighbor(const GSAISteeringAgent &val);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
float get__shortest_time() const;
|
|
|
|
void set__shortest_time(const float val);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
float get__first_minimum_separation() const;
|
|
|
|
void set__first_minimum_separation(const float val);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
float get__first_distance() const;
|
|
|
|
void set__first_distance(const float val);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
Vector3 get__first_relative_position();
|
|
|
|
void set__first_relative_position(const Vector3 &val);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
Vector3 get__first_relative_velocity();
|
|
|
|
void set__first_relative_velocity(const Vector3 &val);
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 21:35:07 +01:00
|
|
|
void _calculate_steering(const GSAITargetAcceleration &acceleration);
|
|
|
|
bool _report_neighbor(const 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
|
|
|
|
GSAISteeringAgent *_first_neighbor;
|
|
|
|
float _shortest_time = 0.0;
|
|
|
|
float _first_minimum_separation = 0.0;
|
|
|
|
float _first_distance = 0.0;
|
|
|
|
Vector3 _first_relative_position = ;
|
|
|
|
Vector3 _first_relative_velocity = ;
|
|
|
|
// Callback for the proximity to call when finding neighbors. Keeps track of every `neighbor`
|
|
|
|
// that was found but only keeps the one the owning agent will most likely collide with.
|
|
|
|
// @tags - virtual
|
2023-01-13 21:13:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|