pandemonium_engine/modules/steering_ai/behaviors/gsai_separation.h

45 lines
1.3 KiB
C++
Raw Normal View History

#ifndef GSAI_SEPARATION_H
#define GSAI_SEPARATION_H
2023-01-14 01:43:20 +01:00
#include "core/object/reference.h"
#include "../gsai_group_behavior.h"
class GSAITargetAcceleration;
class GSAISeparation : public GSAIGroupBehavior {
GDCLASS(GSAISeparation, GSAIGroupBehavior);
public:
float get_decay_coefficient() const;
void set_decay_coefficient(const float val);
2023-01-14 01:43:20 +01:00
Ref<GSAITargetAcceleration> get_acceleration();
void set_acceleration(const Ref<GSAITargetAcceleration> &val);
2023-01-14 01:43:20 +01:00
void _calculate_steering(Ref<GSAITargetAcceleration> p_acceleration);
bool _report_neighbor(Ref<GSAISteeringAgent> p_neighbor);
GSAISeparation();
~GSAISeparation();
protected:
static void _bind_methods();
// Calculates an acceleration that repels the agent from its neighbors in the
// given `GSAIProximity`.
//
// The acceleration is an average based on all neighbors, multiplied by a
// strength decreasing by the inverse square law in relation to distance, and it
// accumulates.
// @category - Group behaviors
// The coefficient to calculate how fast the separation strength decays with distance.
2023-01-14 01:43:20 +01:00
float decay_coefficient;
Ref<GSAITargetAcceleration> acceleration;
// Callback for the proximity to call when finding neighbors. Determines the amount of
// acceleration that `neighbor` imposes based on its distance from the owner agent.
// @tags - virtual
};
#endif