2023-01-13 22:04:30 +01:00
|
|
|
#ifndef GSAI_STEERING_BEHAVIOR_H
|
|
|
|
#define GSAI_STEERING_BEHAVIOR_H
|
2023-01-13 21:13:57 +01:00
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
#include "core/int_types.h"
|
|
|
|
#include "core/math/vector3.h"
|
|
|
|
|
|
|
|
#include "core/object/reference.h"
|
|
|
|
|
|
|
|
class GSAISteeringAgent;
|
|
|
|
class GSAITargetAcceleration;
|
|
|
|
|
|
|
|
// Base class for all steering behaviors.
|
|
|
|
// Steering behaviors calculate the linear and the angular acceleration to be
|
|
|
|
// to the agent that owns them.
|
|
|
|
// Individual steering behaviors encapsulate the steering logic.
|
|
|
|
|
2023-01-13 21:13:57 +01:00
|
|
|
class GSAISteeringBehavior : public Reference {
|
2023-01-13 21:35:07 +01:00
|
|
|
GDCLASS(GSAISteeringBehavior, Reference);
|
|
|
|
|
|
|
|
public:
|
2023-01-13 23:01:38 +01:00
|
|
|
// If `false`, all calculations return zero amounts of acceleration.
|
2023-01-13 21:35:07 +01:00
|
|
|
bool get_is_enabled() const;
|
|
|
|
void set_is_enabled(const bool val);
|
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
// The AI agent on which the steering behavior bases its calculations.
|
|
|
|
Ref<GSAISteeringAgent> get_agent();
|
|
|
|
void set_agent(const Ref<GSAISteeringAgent> &val);
|
2023-01-13 21:35:07 +01:00
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
// The `calculate_steering` function is the entry point for all behaviors.
|
|
|
|
// Sets the `acceleration` with the behavior's desired amount of acceleration.
|
|
|
|
void calculate_steering(Ref<GSAITargetAcceleration> acceleration);
|
|
|
|
void _calculate_steering(Ref<GSAITargetAcceleration> acceleration);
|
2023-01-13 21:35:07 +01:00
|
|
|
|
|
|
|
GSAISteeringBehavior();
|
|
|
|
~GSAISteeringBehavior();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2023-01-13 23:01:38 +01:00
|
|
|
bool is_enabled;
|
|
|
|
|
|
|
|
Ref<GSAISteeringAgent> agent;
|
2023-01-13 21:13:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|