diff --git a/modules/steering_ai/agents/gsai_kinematic_body_2d_agent.h b/modules/steering_ai/agents/gsai_kinematic_body_2d_agent.h index 3dcb297c7..2919dfa5a 100644 --- a/modules/steering_ai/agents/gsai_kinematic_body_2d_agent.h +++ b/modules/steering_ai/agents/gsai_kinematic_body_2d_agent.h @@ -25,7 +25,7 @@ public: void _physics_process_connect(); void _physics_process_disconnect(); - + void _apply_steering(Ref acceleration, float delta); void _apply_sliding_steering(KinematicBody2D *body, const Vector3 &accel, const float delta); @@ -41,21 +41,9 @@ public: protected: static void _bind_methods(); - // A specialized steering agent that updates itself every frame so the user does - // not have to using a KinematicBody2D - // @category - Specialized agents - // SLIDE uses `move_and_slide` - // COLLIDE uses `move_and_collide` - // POSITION changes the `global_position` directly - - // The KinematicBody2D to keep track of - // setget _set_body - // The type of movement the body executes int movement_type; Vector2 _last_position; ObjectID _body_ref; - // Moves the agent's `body` by target `acceleration`. - // @tags - virtual }; #endif diff --git a/modules/steering_ai/agents/gsai_kinematic_body_3d_agent.h b/modules/steering_ai/agents/gsai_kinematic_body_3d_agent.h index 20f41eef8..40313ce38 100644 --- a/modules/steering_ai/agents/gsai_kinematic_body_3d_agent.h +++ b/modules/steering_ai/agents/gsai_kinematic_body_3d_agent.h @@ -41,21 +41,9 @@ public: protected: static void _bind_methods(); - // A specialized steering agent that updates itself every frame so the user does - // not have to using a KinematicBody - // @category - Specialized agents - // SLIDE uses `move_and_slide` - // COLLIDE uses `move_and_collide` - // POSITION changes the global_position directly - - // The KinematicBody to keep track of - // setget _set_body - // The type of movement the body executes int movement_type; Vector3 _last_position; ObjectID _body_ref; - // Moves the agent's `body` by target `acceleration`. - // @tags - virtual }; #endif diff --git a/modules/steering_ai/agents/gsai_rigid_body_2d_agent.h b/modules/steering_ai/agents/gsai_rigid_body_2d_agent.h index 2517032e0..2002ac105 100644 --- a/modules/steering_ai/agents/gsai_rigid_body_2d_agent.h +++ b/modules/steering_ai/agents/gsai_rigid_body_2d_agent.h @@ -27,15 +27,8 @@ public: protected: static void _bind_methods(); - // A specialized steering agent that updates itself every frame so the user does - // not have to using a RigidBody2D - // @category - Specialized agents - // The RigidBody2D to keep track of - // setget _set_body Vector2 _last_position; ObjectID _body_ref; - // Moves the agent's `body` by target `acceleration`. - // @tags - virtual }; #endif diff --git a/modules/steering_ai/agents/gsai_rigid_body_3d_agent.h b/modules/steering_ai/agents/gsai_rigid_body_3d_agent.h index 207a374d8..8e67785f4 100644 --- a/modules/steering_ai/agents/gsai_rigid_body_3d_agent.h +++ b/modules/steering_ai/agents/gsai_rigid_body_3d_agent.h @@ -27,15 +27,8 @@ public: protected: static void _bind_methods(); - // A specialized steering agent that updates itself every frame so the user does - // not have to using a RigidBody - // @category - Specialized agents - // The RigidBody to keep track of - // setget _set_body Vector3 _last_position; ObjectID _body_ref; - // Moves the agent's `body` by target `acceleration`. - // @tags - virtual }; #endif diff --git a/modules/steering_ai/agents/gsai_specialized_agent.h b/modules/steering_ai/agents/gsai_specialized_agent.h index e47b037fd..8fbf46638 100644 --- a/modules/steering_ai/agents/gsai_specialized_agent.h +++ b/modules/steering_ai/agents/gsai_specialized_agent.h @@ -41,33 +41,13 @@ public: protected: static void _bind_methods(); - // A base class for a specialized steering agent that updates itself every frame - // so the user does not have to. All other specialized agents derive from this. - // @category - Specialized agents - // @tags - abstract - // If `true`, calculates linear and angular velocities based on the previous - // frame. When `false`, the user must keep those values updated. bool calculate_velocities; - // If `true`, interpolates the current linear velocity towards 0 by the - // `linear_drag_percentage` value. - // Does not apply to `RigidBody` and `RigidBody2D` nodes. bool apply_linear_drag; - // If `true`, interpolates the current angular velocity towards 0 by the - // `angular_drag_percentage` value. - // Does not apply to `RigidBody` and `RigidBody2D` nodes. bool apply_angular_drag; - // The percentage between the current linear velocity and 0 to interpolate by if - // `apply_linear_drag` is true. - // Does not apply to `RigidBody` and `RigidBody2D` nodes. float linear_drag_percentage; - // The percentage between the current angular velocity and 0 to interpolate by if - // `apply_angular_drag` is true. - // Does not apply to `RigidBody` and `RigidBody2D` nodes. float angular_drag_percentage; float last_orientation; bool applied_steering; - // Moves the agent's body by target `acceleration`. - // @tags - virtual }; #endif diff --git a/modules/steering_ai/behaviors/gsai_arrive.h b/modules/steering_ai/behaviors/gsai_arrive.h index 5a2cc049a..3fdbb136f 100644 --- a/modules/steering_ai/behaviors/gsai_arrive.h +++ b/modules/steering_ai/behaviors/gsai_arrive.h @@ -34,17 +34,9 @@ public: protected: static void _bind_methods(); - // Calculates acceleration to take an agent to its target's location. The - // calculation attempts to arrive with zero remaining velocity. - // @category - Individual behaviors - // Target agent to arrive to. Ref target; - // Distance from the target for the agent to be considered successfully - // arrived. float arrival_tolerance; - // Distance from the target for the agent to begin slowing down. float deceleration_radius; - // Represents the time it takes to change acceleration. float time_to_reach; }; diff --git a/modules/steering_ai/behaviors/gsai_avoid_collisions.h b/modules/steering_ai/behaviors/gsai_avoid_collisions.h index c98cf91d6..03ace22e6 100644 --- a/modules/steering_ai/behaviors/gsai_avoid_collisions.h +++ b/modules/steering_ai/behaviors/gsai_avoid_collisions.h @@ -21,9 +21,6 @@ public: protected: static void _bind_methods(); - // Steers the agent to avoid obstacles in its path. Approximates obstacles as - // spheres. - // @category - Group behaviors Ref _first_neighbor; float _shortest_time; float _first_minimum_separation; diff --git a/modules/steering_ai/behaviors/gsai_blend.cpp b/modules/steering_ai/behaviors/gsai_blend.cpp index b365be6a2..b087ffb00 100644 --- a/modules/steering_ai/behaviors/gsai_blend.cpp +++ b/modules/steering_ai/behaviors/gsai_blend.cpp @@ -67,6 +67,7 @@ GSAIBlend::~GSAIBlend() { void GSAIBlend::_bind_methods() { ClassDB::bind_method(D_METHOD("add_behavior", "behavior", "weight"), &GSAIBlend::add_behavior); ClassDB::bind_method(D_METHOD("get_behavior", "index"), &GSAIBlend::get_behavior); + ClassDB::bind_method(D_METHOD("get_behavior_weight", "index"), &GSAIBlend::get_behavior_weight); ClassDB::bind_method(D_METHOD("remove_behavior", "index"), &GSAIBlend::remove_behavior); ClassDB::bind_method(D_METHOD("get_behaviour_count"), &GSAIBlend::get_behaviour_count); ClassDB::bind_method(D_METHOD("get_accel"), &GSAIBlend::get_accel); diff --git a/modules/steering_ai/behaviors/gsai_blend.h b/modules/steering_ai/behaviors/gsai_blend.h index 5f16263ad..b37bb3240 100644 --- a/modules/steering_ai/behaviors/gsai_blend.h +++ b/modules/steering_ai/behaviors/gsai_blend.h @@ -34,14 +34,8 @@ protected: protected: static void _bind_methods(); - // Blends multiple steering behaviors into one, and returns a weighted - // acceleration from their calculations. - // @category - Combination behaviors Vector _behaviors; Ref _accel; - // Appends a behavior to the internal array along with its `weight`. - // Returns the behavior at the specified `index`, or an empty `Dictionary` if - // none was found. }; #endif diff --git a/modules/steering_ai/behaviors/gsai_cohesion.h b/modules/steering_ai/behaviors/gsai_cohesion.h index d5666b707..ee3cccb40 100644 --- a/modules/steering_ai/behaviors/gsai_cohesion.h +++ b/modules/steering_ai/behaviors/gsai_cohesion.h @@ -21,9 +21,6 @@ public: protected: static void _bind_methods(); - // Calculates an acceleration that attempts to move the agent towards the center - // of mass of the agents in the area defined by the `GSAIProximity`. - // @category - Group behaviors Vector3 _center_of_mass; }; diff --git a/modules/steering_ai/behaviors/gsai_evade.h b/modules/steering_ai/behaviors/gsai_evade.h index 4bb2cceef..ad05653f5 100644 --- a/modules/steering_ai/behaviors/gsai_evade.h +++ b/modules/steering_ai/behaviors/gsai_evade.h @@ -16,10 +16,6 @@ public: protected: static void _bind_methods(); - - // Calculates acceleration to take an agent away from where a target agent is - // moving. - // @category - Individual behaviors }; #endif diff --git a/modules/steering_ai/behaviors/gsai_face.h b/modules/steering_ai/behaviors/gsai_face.h index a866362f4..0d2c9caec 100644 --- a/modules/steering_ai/behaviors/gsai_face.h +++ b/modules/steering_ai/behaviors/gsai_face.h @@ -21,10 +21,6 @@ public: protected: static void _bind_methods(); - - // Calculates angular acceleration to rotate a target to face its target's - // position. The behavior attemps to arrive with zero remaining angular velocity. - // @category - Individual behaviors }; #endif diff --git a/modules/steering_ai/behaviors/gsai_flee.h b/modules/steering_ai/behaviors/gsai_flee.h index 061e1890e..b323ff6af 100644 --- a/modules/steering_ai/behaviors/gsai_flee.h +++ b/modules/steering_ai/behaviors/gsai_flee.h @@ -18,9 +18,6 @@ public: protected: static void _bind_methods(); - - // Calculates acceleration to take an agent directly away from a target agent. - // @category - Individual behaviors }; #endif diff --git a/modules/steering_ai/behaviors/gsai_follow_path.h b/modules/steering_ai/behaviors/gsai_follow_path.h index c0f4ffa24..b17d9fd1a 100644 --- a/modules/steering_ai/behaviors/gsai_follow_path.h +++ b/modules/steering_ai/behaviors/gsai_follow_path.h @@ -31,16 +31,9 @@ public: protected: static void _bind_methods(); - // Produces a linear acceleration that moves the agent along the specified path. - // @category - Individual behaviors - // The path to follow and travel along. Ref path; - // The distance along the path to generate the next target position. float path_offset; - // Whether to use `GSAIArrive` behavior on an open path. bool is_arrive_enabled; - // The amount of time in the future to predict the owning agent's position along - // the path. Setting it to 0.0 will force non-predictive path following. float prediction_time; }; diff --git a/modules/steering_ai/behaviors/gsai_look_where_you_go.h b/modules/steering_ai/behaviors/gsai_look_where_you_go.h index a13944a31..7caaf7a3f 100644 --- a/modules/steering_ai/behaviors/gsai_look_where_you_go.h +++ b/modules/steering_ai/behaviors/gsai_look_where_you_go.h @@ -18,10 +18,6 @@ public: protected: static void _bind_methods(); - - // Calculates an angular acceleration to match an agent's orientation to its - // direction of travel. - // @category - Individual behaviors }; #endif diff --git a/modules/steering_ai/behaviors/gsai_match_orientation.h b/modules/steering_ai/behaviors/gsai_match_orientation.h index 309542428..cd0b4337d 100644 --- a/modules/steering_ai/behaviors/gsai_match_orientation.h +++ b/modules/steering_ai/behaviors/gsai_match_orientation.h @@ -29,7 +29,7 @@ public: void match_orientation(const Ref &acceleration, const float desired_orientation); virtual void _match_orientation(Ref acceleration, float desired_orientation); - + void _calculate_steering(Ref acceleration); GSAIMatchOrientation(); @@ -38,21 +38,10 @@ public: protected: static void _bind_methods(); - // Calculates an angular acceleration to match an agent's orientation to that of - // its target. Attempts to make the agent arrive with zero remaining angular - // velocity. - // @category - Individual behaviors - // The target orientation for the behavior to try and match rotations to. Ref target; - // The amount of distance in radians for the behavior to consider itself close - // enough to be matching the target agent's rotation. float alignment_tolerance; - // The amount of distance in radians from the goal to start slowing down. float deceleration_radius; - // The amount of time to reach the target velocity float time_to_reach; - // Whether to use the X and Z components instead of X and Y components when - // determining angles. X and Z should be used in 3D. bool use_z; }; diff --git a/modules/steering_ai/behaviors/gsai_priority.h b/modules/steering_ai/behaviors/gsai_priority.h index 22bce0170..42f345099 100644 --- a/modules/steering_ai/behaviors/gsai_priority.h +++ b/modules/steering_ai/behaviors/gsai_priority.h @@ -28,18 +28,9 @@ public: protected: static void _bind_methods(); - // Container for multiple behaviors that returns the result of the first child - // behavior with non-zero acceleration. - // @category - Combination behaviors - // If a behavior's acceleration is lower than this threshold, the container - // considers it has an acceleration of zero. float zero_threshold; - // The index of the last behavior the container prioritized. int _last_selected_index; Vector> _behaviors; - // Appends a steering behavior as a child of this container. - // Returns the behavior at the position in the pool referred to by `index`, or - // `null` if no behavior was found. }; #endif diff --git a/modules/steering_ai/behaviors/gsai_pursue.h b/modules/steering_ai/behaviors/gsai_pursue.h index 061aca5b7..d9b62dbd3 100644 --- a/modules/steering_ai/behaviors/gsai_pursue.h +++ b/modules/steering_ai/behaviors/gsai_pursue.h @@ -19,7 +19,7 @@ public: void set_predict_time_max(const float val); void _calculate_steering(Ref acceleration); - + float get_modified_acceleration(); virtual float _get_modified_acceleration(); @@ -29,13 +29,7 @@ public: protected: static void _bind_methods(); - // Calculates an acceleration to make an agent intercept another based on the - // target agent's movement. - // @category - Individual behaviors - // The target agent that the behavior is trying to intercept. Ref target; - // The maximum amount of time in the future the behavior predicts the target's - // location. float predict_time_max; }; diff --git a/modules/steering_ai/behaviors/gsai_seek.h b/modules/steering_ai/behaviors/gsai_seek.h index 73c22d251..0bfb134e1 100644 --- a/modules/steering_ai/behaviors/gsai_seek.h +++ b/modules/steering_ai/behaviors/gsai_seek.h @@ -23,10 +23,6 @@ public: protected: static void _bind_methods(); - // Calculates an acceleration to take an agent to a target agent's position - // directly. - // @category - Individual behaviors - // The target that the behavior aims to move the agent to. Ref target; }; diff --git a/modules/steering_ai/behaviors/gsai_separation.h b/modules/steering_ai/behaviors/gsai_separation.h index a444020e1..35b7ae111 100644 --- a/modules/steering_ai/behaviors/gsai_separation.h +++ b/modules/steering_ai/behaviors/gsai_separation.h @@ -26,19 +26,8 @@ public: 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. float decay_coefficient; Ref 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 diff --git a/modules/steering_ai/doc_classes/GSAIAgentLocation.xml b/modules/steering_ai/doc_classes/GSAIAgentLocation.xml index 74944f91b..415fe74bd 100644 --- a/modules/steering_ai/doc_classes/GSAIAgentLocation.xml +++ b/modules/steering_ai/doc_classes/GSAIAgentLocation.xml @@ -1,8 +1,10 @@ + Represents an agent with only a location and an orientation. + Represents an agent with only a location and an orientation. @@ -10,8 +12,10 @@ + The agent's orientation on its Y axis rotation. + The agent's position in space. diff --git a/modules/steering_ai/doc_classes/GSAIArrive.xml b/modules/steering_ai/doc_classes/GSAIArrive.xml index 34c11c1d4..4107e5cda 100644 --- a/modules/steering_ai/doc_classes/GSAIArrive.xml +++ b/modules/steering_ai/doc_classes/GSAIArrive.xml @@ -1,8 +1,10 @@ + Calculates acceleration to take an agent to its target's location. The calculation attempts to arrive with zero remaining velocity. + Calculates acceleration to take an agent to its target's location. The calculation attempts to arrive with zero remaining velocity. @@ -24,12 +26,16 @@ + Distance from the target for the agent to be considered successfully arrived. + Distance from the target for the agent to begin slowing down. + Target agent to arrive to. + Represents the time it takes to change acceleration. diff --git a/modules/steering_ai/doc_classes/GSAIAvoidCollisions.xml b/modules/steering_ai/doc_classes/GSAIAvoidCollisions.xml index 86e56c91b..230caa8cf 100644 --- a/modules/steering_ai/doc_classes/GSAIAvoidCollisions.xml +++ b/modules/steering_ai/doc_classes/GSAIAvoidCollisions.xml @@ -1,8 +1,10 @@ + Steers the agent to avoid obstacles in its path. Approximates obstacles as spheres. + Steers the agent to avoid obstacles in its path. Approximates obstacles as spheres. diff --git a/modules/steering_ai/doc_classes/GSAIBlend.xml b/modules/steering_ai/doc_classes/GSAIBlend.xml index 98dd75bc6..07f6538dd 100644 --- a/modules/steering_ai/doc_classes/GSAIBlend.xml +++ b/modules/steering_ai/doc_classes/GSAIBlend.xml @@ -1,8 +1,10 @@ + Blends multiple steering behaviors into one, and returns a weighted acceleration from their calculations. + Blends multiple steering behaviors into one, and returns a weighted acceleration from their calculations. @@ -12,28 +14,40 @@ + Appends a behavior to the internal array along with its weight. + Returns the internal GSAITargetAcceleration. + Returns the behavior at the specified index, or null if none was found. + + + + + + + Returns the behavior's weight at the specified index, or null if none was found. + Returns how many behaviors are added. + Removed the behavior at the specified index. diff --git a/modules/steering_ai/doc_classes/GSAICohesion.xml b/modules/steering_ai/doc_classes/GSAICohesion.xml index 6d89b902c..ba83b08d7 100644 --- a/modules/steering_ai/doc_classes/GSAICohesion.xml +++ b/modules/steering_ai/doc_classes/GSAICohesion.xml @@ -1,8 +1,10 @@ + Calculates an acceleration that attempts to move the agent towards the center of mass of the agents in the area defined by the GSAIProximity. + Calculates an acceleration that attempts to move the agent towards the center of mass of the agents in the area defined by the GSAIProximity. diff --git a/modules/steering_ai/doc_classes/GSAIEvade.xml b/modules/steering_ai/doc_classes/GSAIEvade.xml index 5fe80d3b9..8f27bbebb 100644 --- a/modules/steering_ai/doc_classes/GSAIEvade.xml +++ b/modules/steering_ai/doc_classes/GSAIEvade.xml @@ -1,8 +1,10 @@ + Calculates acceleration to take an agent away from where a target agent is moving. + Calculates acceleration to take an agent away from where a target agent is moving. diff --git a/modules/steering_ai/doc_classes/GSAIFace.xml b/modules/steering_ai/doc_classes/GSAIFace.xml index b9f0db257..b3a524991 100644 --- a/modules/steering_ai/doc_classes/GSAIFace.xml +++ b/modules/steering_ai/doc_classes/GSAIFace.xml @@ -1,8 +1,10 @@ + Calculates angular acceleration to rotate a target to face its target's position. The behavior attemps to arrive with zero remaining angular velocity. + Calculates angular acceleration to rotate a target to face its target's position. The behavior attemps to arrive with zero remaining angular velocity. diff --git a/modules/steering_ai/doc_classes/GSAIFlee.xml b/modules/steering_ai/doc_classes/GSAIFlee.xml index 27f726390..d6913f60f 100644 --- a/modules/steering_ai/doc_classes/GSAIFlee.xml +++ b/modules/steering_ai/doc_classes/GSAIFlee.xml @@ -1,8 +1,10 @@ + Calculates acceleration to take an agent directly away from a target agent. + Calculates acceleration to take an agent directly away from a target agent. diff --git a/modules/steering_ai/doc_classes/GSAIFollowPath.xml b/modules/steering_ai/doc_classes/GSAIFollowPath.xml index 8faa38704..cb8aeb905 100644 --- a/modules/steering_ai/doc_classes/GSAIFollowPath.xml +++ b/modules/steering_ai/doc_classes/GSAIFollowPath.xml @@ -1,8 +1,10 @@ + Produces a linear acceleration that moves the agent along the specified path. + Produces a linear acceleration that moves the agent along the specified path. @@ -10,12 +12,16 @@ + Whether to use GSAIArrive behavior on an open path. + The path to follow and travel along. + The distance along the path to generate the next target position. + The amount of time in the future to predict the owning agent's position along the path. Setting it to 0.0 will force non-predictive path following. diff --git a/modules/steering_ai/doc_classes/GSAIGroupBehavior.xml b/modules/steering_ai/doc_classes/GSAIGroupBehavior.xml index 07ec1a57e..b657ab2e7 100644 --- a/modules/steering_ai/doc_classes/GSAIGroupBehavior.xml +++ b/modules/steering_ai/doc_classes/GSAIGroupBehavior.xml @@ -1,8 +1,10 @@ + Base type for group-based steering behaviors. + Base type for group-based steering behaviors. @@ -16,8 +18,10 @@ + Internal callback for the behavior to define whether or not a member is relevant + Container to find neighbors of the agent and calculate group behavior. diff --git a/modules/steering_ai/doc_classes/GSAIInfiniteProximity.xml b/modules/steering_ai/doc_classes/GSAIInfiniteProximity.xml index cdb42f001..6228f8084 100644 --- a/modules/steering_ai/doc_classes/GSAIInfiniteProximity.xml +++ b/modules/steering_ai/doc_classes/GSAIInfiniteProximity.xml @@ -1,8 +1,10 @@ + Determines any agent that is in the specified list as being neighbors with the owner agent, regardless of distance. + Determines any agent that is in the specified list as being neighbors with the owner agent, regardless of distance. diff --git a/modules/steering_ai/doc_classes/GSAIKinematicBody2DAgent.xml b/modules/steering_ai/doc_classes/GSAIKinematicBody2DAgent.xml index 63a47273c..de0653023 100644 --- a/modules/steering_ai/doc_classes/GSAIKinematicBody2DAgent.xml +++ b/modules/steering_ai/doc_classes/GSAIKinematicBody2DAgent.xml @@ -1,8 +1,10 @@ + A specialized steering agent that updates itself every frame so the user does not have to using a KinematicBody2D. + A specialized steering agent that updates itself every frame so the user does not have to using a KinematicBody2D. @@ -10,8 +12,12 @@ + The KinematicBody2D to keep track of. + SLIDE uses move_and_slide. + COLLIDE uses move_and_collide. + POSITION changes the global_position directly. diff --git a/modules/steering_ai/doc_classes/GSAIKinematicBody3DAgent.xml b/modules/steering_ai/doc_classes/GSAIKinematicBody3DAgent.xml index 763f688f8..fa355418f 100644 --- a/modules/steering_ai/doc_classes/GSAIKinematicBody3DAgent.xml +++ b/modules/steering_ai/doc_classes/GSAIKinematicBody3DAgent.xml @@ -1,8 +1,10 @@ + A specialized steering agent that updates itself every frame so the user does not have to using a KinematicBody. + A specialized steering agent that updates itself every frame so the user does not have to using a KinematicBody. @@ -10,8 +12,12 @@ + The KinematicBody to keep track of. + SLIDE uses move_and_slide. + COLLIDE uses move_and_collide. + POSITION changes the global_position directly. diff --git a/modules/steering_ai/doc_classes/GSAILookWhereYouGo.xml b/modules/steering_ai/doc_classes/GSAILookWhereYouGo.xml index 0e26d69cc..9f1070ed6 100644 --- a/modules/steering_ai/doc_classes/GSAILookWhereYouGo.xml +++ b/modules/steering_ai/doc_classes/GSAILookWhereYouGo.xml @@ -1,8 +1,10 @@ + Calculates an angular acceleration to match an agent's orientation to its direction of travel. + Calculates an angular acceleration to match an agent's orientation to its direction of travel. diff --git a/modules/steering_ai/doc_classes/GSAIMatchOrientation.xml b/modules/steering_ai/doc_classes/GSAIMatchOrientation.xml index 61235b6ff..87a382a29 100644 --- a/modules/steering_ai/doc_classes/GSAIMatchOrientation.xml +++ b/modules/steering_ai/doc_classes/GSAIMatchOrientation.xml @@ -1,8 +1,10 @@ + Calculates an angular acceleration to match an agent's orientation to that of its target. Attempts to make the agent arrive with zero remaining angular velocity. + Calculates an angular acceleration to match an agent's orientation to that of its target. Attempts to make the agent arrive with zero remaining angular velocity. @@ -24,14 +26,19 @@ + The amount of distance in radians for the behavior to consider itself close enough to be matching the target agent's rotation. + The amount of distance in radians from the goal to start slowing down. + The target orientation for the behavior to try and match rotations to. + The amount of time to reach the target velocity + Whether to use the X and Z components instead of X and Y components when determining angles. X and Z should be used in 3D. diff --git a/modules/steering_ai/doc_classes/GSAIPath.xml b/modules/steering_ai/doc_classes/GSAIPath.xml index 6e5a7d6f6..6994c68d6 100644 --- a/modules/steering_ai/doc_classes/GSAIPath.xml +++ b/modules/steering_ai/doc_classes/GSAIPath.xml @@ -1,8 +1,10 @@ + Represents a path made up of Vector3 waypoints, split into segments path follow behaviors can use. + Represents a path made up of Vector3 waypoints, split into segments path follow behaviors can use. @@ -17,22 +19,26 @@ + Calculates a target position from the path's starting point based on the target_distance. + Creates a path from a list of waypoints. + Returns the position of the last point on the path. + Returns the position of the first point on the path. @@ -45,8 +51,10 @@ + If false, the path loops. + Total length of the path. diff --git a/modules/steering_ai/doc_classes/GSAIPriority.xml b/modules/steering_ai/doc_classes/GSAIPriority.xml index 97673d330..2d5c322bf 100644 --- a/modules/steering_ai/doc_classes/GSAIPriority.xml +++ b/modules/steering_ai/doc_classes/GSAIPriority.xml @@ -1,8 +1,10 @@ + Container for multiple behaviors that returns the result of the first child behavior with non-zero acceleration. + Container for multiple behaviors that returns the result of the first child behavior with non-zero acceleration. @@ -11,28 +13,33 @@ + Appends a steering behavior as a child of this container. + Returns the behavior at the position in the pool referred to by index, or null if no behavior was found. + Returns how many behaviors are added. + Removed the behavior at the position in the pool referred to by index. + If a behavior's acceleration is lower than this threshold, the container considers it has an acceleration of zero. diff --git a/modules/steering_ai/doc_classes/GSAIProximity.xml b/modules/steering_ai/doc_classes/GSAIProximity.xml index a14218950..57e9c2db0 100644 --- a/modules/steering_ai/doc_classes/GSAIProximity.xml +++ b/modules/steering_ai/doc_classes/GSAIProximity.xml @@ -1,8 +1,10 @@ + Base container type that stores data to find the neighbors of an agent. + Base container type that stores data to find the neighbors of an agent. @@ -11,19 +13,25 @@ + Returns a number of neighbors based on a `callback` function. + _find_neighbors calls callback for each agent in the agents array and adds one to the count if its callback returns true. + Returns a number of neighbors based on a `callback` function. + _find_neighbors calls callback for each agent in the agents array and adds one to the count if its callback returns true. + The owning agent whose neighbors are found in the group + The agents who are part of this group and could be potential neighbors diff --git a/modules/steering_ai/doc_classes/GSAIPursue.xml b/modules/steering_ai/doc_classes/GSAIPursue.xml index 37d6ef431..00e82b9f7 100644 --- a/modules/steering_ai/doc_classes/GSAIPursue.xml +++ b/modules/steering_ai/doc_classes/GSAIPursue.xml @@ -1,8 +1,10 @@ + Calculates an acceleration to make an agent intercept another based on the target agent's movement. + Calculates an acceleration to make an agent intercept another based on the target agent's movement. @@ -20,8 +22,10 @@ + The maximum amount of time in the future the behavior predicts the target's location. + The target agent that the behavior is trying to intercept. diff --git a/modules/steering_ai/doc_classes/GSAIRadiusProximity.xml b/modules/steering_ai/doc_classes/GSAIRadiusProximity.xml index 67a958238..a5777601a 100644 --- a/modules/steering_ai/doc_classes/GSAIRadiusProximity.xml +++ b/modules/steering_ai/doc_classes/GSAIRadiusProximity.xml @@ -1,8 +1,10 @@ + Determines any agent that is in the specified list as being neighbors with the owner agent if they lie within the specified radius. + Determines any agent that is in the specified list as being neighbors with the owner agent if they lie within the specified radius. @@ -10,6 +12,7 @@ + The radius around the owning agent to find neighbors in diff --git a/modules/steering_ai/doc_classes/GSAIRigidBody2DAgent.xml b/modules/steering_ai/doc_classes/GSAIRigidBody2DAgent.xml index 108dcae26..49a5a661c 100644 --- a/modules/steering_ai/doc_classes/GSAIRigidBody2DAgent.xml +++ b/modules/steering_ai/doc_classes/GSAIRigidBody2DAgent.xml @@ -1,8 +1,10 @@ + A specialized steering agent that updates itself every frame so the user does not have to using a RigidBody2D. + A specialized steering agent that updates itself every frame so the user does not have to using a RigidBody2D. @@ -10,6 +12,7 @@ + The RigidBody2D to keep track of. diff --git a/modules/steering_ai/doc_classes/GSAIRigidBody3DAgent.xml b/modules/steering_ai/doc_classes/GSAIRigidBody3DAgent.xml index 0e014c409..7b42873dc 100644 --- a/modules/steering_ai/doc_classes/GSAIRigidBody3DAgent.xml +++ b/modules/steering_ai/doc_classes/GSAIRigidBody3DAgent.xml @@ -1,8 +1,10 @@ + A specialized steering agent that updates itself every frame so the user does not have to using a RigidBody + A specialized steering agent that updates itself every frame so the user does not have to using a RigidBody @@ -10,6 +12,7 @@ + The RigidBody to keep track of. diff --git a/modules/steering_ai/doc_classes/GSAISeek.xml b/modules/steering_ai/doc_classes/GSAISeek.xml index 47882283f..9122f412f 100644 --- a/modules/steering_ai/doc_classes/GSAISeek.xml +++ b/modules/steering_ai/doc_classes/GSAISeek.xml @@ -1,8 +1,10 @@ + Calculates an acceleration to take an agent to a target agent's position directly. + Calculates an acceleration to take an agent to a target agent's position directly. @@ -10,6 +12,7 @@ + The target that the behavior aims to move the agent to. diff --git a/modules/steering_ai/doc_classes/GSAISeparation.xml b/modules/steering_ai/doc_classes/GSAISeparation.xml index f2700a761..e831a79c1 100644 --- a/modules/steering_ai/doc_classes/GSAISeparation.xml +++ b/modules/steering_ai/doc_classes/GSAISeparation.xml @@ -1,8 +1,11 @@ + Calculates an acceleration that repels the agent from its neighbors in the given GSAIProximity. + Calculates an acceleration that repels the agent from its neighbors in the given GSAIProximity. + _callback is the 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. @@ -11,8 +14,10 @@ + 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. + The coefficient to calculate how fast the separation strength decays with distance. diff --git a/modules/steering_ai/doc_classes/GSAISpecializedAgent.xml b/modules/steering_ai/doc_classes/GSAISpecializedAgent.xml index 046fe69b0..0c012c33d 100644 --- a/modules/steering_ai/doc_classes/GSAISpecializedAgent.xml +++ b/modules/steering_ai/doc_classes/GSAISpecializedAgent.xml @@ -1,8 +1,10 @@ + A base class for a specialized steering agent that updates itself every frame so the user does not have to. All other specialized agents derive from this. + A base class for a specialized steering agent that updates itself every frame so the user does not have to. All other specialized agents derive from this. @@ -12,6 +14,7 @@ + Moves the agent's body by target acceleration. @@ -19,23 +22,29 @@ + Moves the agent's body by target acceleration. + The percentage between the current angular velocity and 0 to interpolate by if apply_angular_drag is true. Does not apply to RigidBody and RigidBody2D nodes. + If true, interpolates the current angular velocity towards 0 by the angular_drag_percentage value. Does not apply to RigidBody and RigidBody2D nodes. + If true, interpolates the current linear velocity towards 0 by the linear_drag_percentage value. Does not apply to RigidBody and RigidBody2D nodes. + If true, calculates linear and angular velocities based on the previous frame. When false, the user must keep those values updated. + The percentage between the current linear velocity and 0 to interpolate by if apply_linear_drag is true. Does not apply to RigidBody and RigidBody2D nodes. diff --git a/modules/steering_ai/doc_classes/GSAISteeringAgent.xml b/modules/steering_ai/doc_classes/GSAISteeringAgent.xml index 4b06ebd08..eef6d8728 100644 --- a/modules/steering_ai/doc_classes/GSAISteeringAgent.xml +++ b/modules/steering_ai/doc_classes/GSAISteeringAgent.xml @@ -1,8 +1,11 @@ + Adds velocity, speed, and size data to GSAIAgentLocation. + Adds velocity, speed, and size data to GSAIAgentLocation. + It is the character's responsibility to keep this information up to date for the steering toolkit to work correctly. @@ -10,22 +13,31 @@ + The maximum amount of angular acceleration that any behavior can apply to an agent. + The maximum amount of angular speed at which the agent can rotate. + Current angular velocity of the agent. + The radius of the sphere that approximates the agent's size in space. + Used internally by group behaviors and proximities to mark the agent as already considered. + The maximum amount of acceleration that any behavior can apply to the agent. + The maximum speed at which the agent can move. + Current velocity of the agent. + The amount of velocity to be considered effectively not moving. diff --git a/modules/steering_ai/doc_classes/GSAISteeringBehavior.xml b/modules/steering_ai/doc_classes/GSAISteeringBehavior.xml index 0456137a5..e0873189e 100644 --- a/modules/steering_ai/doc_classes/GSAISteeringBehavior.xml +++ b/modules/steering_ai/doc_classes/GSAISteeringBehavior.xml @@ -1,8 +1,12 @@ + Base class for all steering behaviors. + 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. @@ -11,19 +15,23 @@ + The calculate_steering function is the entry point for all behaviors. Sets the acceleration with the behavior's desired amount of acceleration. + The calculate_steering function is the entry point for all behaviors. Sets the acceleration with the behavior's desired amount of acceleration. + The AI agent on which the steering behavior bases its calculations. + If false, all calculations return zero amounts of acceleration. diff --git a/modules/steering_ai/doc_classes/GSAITargetAcceleration.xml b/modules/steering_ai/doc_classes/GSAITargetAcceleration.xml index c9679f13c..f6dbbf896 100644 --- a/modules/steering_ai/doc_classes/GSAITargetAcceleration.xml +++ b/modules/steering_ai/doc_classes/GSAITargetAcceleration.xml @@ -1,8 +1,10 @@ + A desired linear and angular amount of acceleration requested by the steering system. + A desired linear and angular amount of acceleration requested by the steering system. @@ -12,28 +14,34 @@ + Adds accel's components, multiplied by scalar, to this one. + Returns the squared magnitude of the linear and angular components. + Returns the squared magnitude of the linear and angular components. + Sets the linear and angular components to 0. + Angular acceleration + Linear acceleration diff --git a/modules/steering_ai/doc_classes/GSAIUtils.xml b/modules/steering_ai/doc_classes/GSAIUtils.xml index 06dd7888c..e69611a94 100644 --- a/modules/steering_ai/doc_classes/GSAIUtils.xml +++ b/modules/steering_ai/doc_classes/GSAIUtils.xml @@ -1,8 +1,10 @@ + Math and vector utility functions. + Math and vector utility functions. @@ -11,6 +13,7 @@ + Returns a directional vector from the given orientation angle. This assumes orientation for 2D agents or 3D agents that are upright and rotate around the Y axis. @@ -18,30 +21,35 @@ + Returns the vector with its length capped to limit. + Returns a vector2 with vector's x and y components. + Returns a vector3 with vector's x and y components and 0 in z. + Returns an angle in radians between the positive X axis and the vector. + Returns an angle in radians between the positive X axis and the vector. This assumes orientation for 3D agents that are upright and rotate around the Y axis. diff --git a/modules/steering_ai/gsai_agent_location.h b/modules/steering_ai/gsai_agent_location.h index 5a631c4dc..d319cdc6b 100644 --- a/modules/steering_ai/gsai_agent_location.h +++ b/modules/steering_ai/gsai_agent_location.h @@ -21,11 +21,7 @@ public: protected: static void _bind_methods(); - // Represents an agent with only a location and an orientation. - // @category - Base types - // The agent's position in space. Vector3 position; - // The agent's orientation on its Y axis rotation. float orientation; }; diff --git a/modules/steering_ai/gsai_group_behavior.h b/modules/steering_ai/gsai_group_behavior.h index 503eb7e2a..135aae985 100644 --- a/modules/steering_ai/gsai_group_behavior.h +++ b/modules/steering_ai/gsai_group_behavior.h @@ -29,14 +29,8 @@ public: protected: static void _bind_methods(); - // Base type for group-based steering behaviors. - // @category - Base types - // Container to find neighbors of the agent and calculate group behavior. Ref proximity; Ref _callback; - // Internal callback for the behavior to define whether or not a member is - // relevant - // @tags - virtual }; #endif diff --git a/modules/steering_ai/gsai_path.h b/modules/steering_ai/gsai_path.h index 75a2d22ba..1c12b29b4 100644 --- a/modules/steering_ai/gsai_path.h +++ b/modules/steering_ai/gsai_path.h @@ -54,23 +54,13 @@ protected: protected: static void _bind_methods(); - // Represents a path made up of Vector3 waypoints, split into segments path - // follow behaviors can use. - // @category - Base types - // If `false`, the path loops. bool is_open; - // Total length of the path. float length; Vector _segments; Vector3 _nearest_point_on_segment; Vector3 _nearest_point_on_path; - // Creates a path from a list of waypoints. - // Calculates a target position from the path's starting point based on the `target_distance`. - // Returns the position of the first point on the path. - // Returns the position of the last point on the path. - // not exposed helper struct }; #endif diff --git a/modules/steering_ai/gsai_steering_agent.h b/modules/steering_ai/gsai_steering_agent.h index f7d088135..16857f253 100644 --- a/modules/steering_ai/gsai_steering_agent.h +++ b/modules/steering_ai/gsai_steering_agent.h @@ -45,30 +45,14 @@ public: protected: static void _bind_methods(); - // Adds velocity, speed, and size data to `GSAIAgentLocation`. - // - // It is the character's responsibility to keep this information up to date for - // the steering toolkit to work correctly. - // @category - Base types - // The amount of velocity to be considered effectively not moving. float zero_linear_speed_threshold; - // The maximum speed at which the agent can move. float linear_speed_max; - // The maximum amount of acceleration that any behavior can apply to the agent. float linear_acceleration_max; - // The maximum amount of angular speed at which the agent can rotate. float angular_speed_max; - // The maximum amount of angular acceleration that any behavior can apply to an - // agent. float angular_acceleration_max; - // Current velocity of the agent. Vector3 linear_velocity; - // Current angular velocity of the agent. float angular_velocity; - // The radius of the sphere that approximates the agent's size in space. float bounding_radius; - // Used internally by group behaviors and proximities to mark the agent as already - // considered. bool is_tagged; }; diff --git a/modules/steering_ai/gsai_steering_behavior.h b/modules/steering_ai/gsai_steering_behavior.h index 92238e03c..74fe945e2 100644 --- a/modules/steering_ai/gsai_steering_behavior.h +++ b/modules/steering_ai/gsai_steering_behavior.h @@ -9,25 +9,16 @@ 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. - class GSAISteeringBehavior : public Reference { GDCLASS(GSAISteeringBehavior, Reference); public: - // If `false`, all calculations return zero amounts of acceleration. bool get_is_enabled() const; void set_is_enabled(const bool val); - // The AI agent on which the steering behavior bases its calculations. Ref get_agent(); void set_agent(const Ref &val); - // 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 acceleration); virtual void _calculate_steering(Ref acceleration); diff --git a/modules/steering_ai/gsai_target_acceleration.h b/modules/steering_ai/gsai_target_acceleration.h index 6c4427eab..c17aefbcf 100644 --- a/modules/steering_ai/gsai_target_acceleration.h +++ b/modules/steering_ai/gsai_target_acceleration.h @@ -5,8 +5,6 @@ #include "core/math/vector3.h" #include "core/object/reference.h" -// A desired linear and angular amount of acceleration requested by the steering system. - class GSAITargetAcceleration : public Reference { GDCLASS(GSAITargetAcceleration, Reference); @@ -17,13 +15,10 @@ public: float get_angular() const; void set_angular(const float val); - // Sets the linear and angular components to 0. void set_zero(); - // Adds `accel`'s components, multiplied by `scalar`, to this one. void add_scaled_accel(const Ref &accel, const float scalar); - // Returns the squared magnitude of the linear and angular components. + float get_magnitude_squared(); - // Returns the magnitude of the linear and angular components. float get_magnitude(); GSAITargetAcceleration(); @@ -32,10 +27,7 @@ public: protected: static void _bind_methods(); - // Linear acceleration Vector3 linear; - - // Angular acceleration float angular; }; diff --git a/modules/steering_ai/gsai_utils.h b/modules/steering_ai/gsai_utils.h index 5cac04e48..e1277a061 100644 --- a/modules/steering_ai/gsai_utils.h +++ b/modules/steering_ai/gsai_utils.h @@ -8,14 +8,10 @@ #include "core/object/object.h" -// Math and vector utility functions. - class GSAIUtils : public Object { GDCLASS(GSAIUtils, Object); public: - // Returns the `vector` with its length capped to `limit`. - static _ALWAYS_INLINE_ Vector3 clampedv3(Vector3 vector, const float limit) { float length_squared = vector.length_squared(); float limit_squared = limit * limit; @@ -27,36 +23,22 @@ public: return vector; } - // Returns an angle in radians between the positive X axis and the `vector`. - // This assumes orientation for 3D agents that are upright and rotate - // around the Y axis. - static _ALWAYS_INLINE_ float vector3_to_angle(const Vector3 &vector) { return atan2(vector.x, vector.z); } - // Returns an angle in radians between the positive X axis and the `vector`. - static _ALWAYS_INLINE_ float vector2_to_angle(const Vector2 &vector) { return atan2(vector.x, -vector.y); } - // Returns a directional vector from the given orientation angle. - // This assumes orientation for 2D agents or 3D agents that are upright and - // rotate around the Y axis. - static _ALWAYS_INLINE_ Vector2 angle_to_vector2(const float angle) { return Vector2(sin(-angle), cos(angle)); } - // Returns a vector2 with `vector`'s x and y components. - static _ALWAYS_INLINE_ Vector2 to_vector2(const Vector3 &vector) { return Vector2(vector.x, vector.y); } - // Returns a vector3 with `vector`'s x and y components and 0 in z. - static _ALWAYS_INLINE_ Vector3 to_vector3(const Vector2 &vector) { return Vector3(vector.x, vector.y, 0); } diff --git a/modules/steering_ai/proximities/gsai_infinite_proximity.h b/modules/steering_ai/proximities/gsai_infinite_proximity.h index 91af4b1a7..d55ee7d4e 100644 --- a/modules/steering_ai/proximities/gsai_infinite_proximity.h +++ b/modules/steering_ai/proximities/gsai_infinite_proximity.h @@ -17,15 +17,6 @@ public: protected: static void _bind_methods(); - - // Determines any agent that is in the specified list as being neighbors with the - // owner agent, regardless of distance. - // @category - Proximities - // Returns a number of neighbors based on a `callback` function. - // - // `_find_neighbors` calls `callback` for each agent in the `agents` array and - // adds one to the count if its `callback` returns true. - // @tags - virtual }; #endif diff --git a/modules/steering_ai/proximities/gsai_proximity.h b/modules/steering_ai/proximities/gsai_proximity.h index 8be90ef6e..62c0d5a76 100644 --- a/modules/steering_ai/proximities/gsai_proximity.h +++ b/modules/steering_ai/proximities/gsai_proximity.h @@ -31,18 +31,8 @@ public: protected: static void _bind_methods(); - // Base container type that stores data to find the neighbors of an agent. - // @category - Proximities - // @tags - abstract - // The owning agent whose neighbors are found in the group Ref agent; - // The agents who are part of this group and could be potential neighbors Vector> agents; - // Returns a number of neighbors based on a `callback` function. - // - // `_find_neighbors` calls `callback` for each agent in the `agents` array and - // adds one to the count if its `callback` returns true. - // @tags - virtual }; #endif diff --git a/modules/steering_ai/proximities/gsai_radius_proximity.h b/modules/steering_ai/proximities/gsai_radius_proximity.h index 32a4d9f0b..7ba489716 100644 --- a/modules/steering_ai/proximities/gsai_radius_proximity.h +++ b/modules/steering_ai/proximities/gsai_radius_proximity.h @@ -23,17 +23,8 @@ public: protected: static void _bind_methods(); - // Determines any agent that is in the specified list as being neighbors with the owner agent if - // they lie within the specified radius. - // @category - Proximities - // The radius around the owning agent to find neighbors in float radius; int _last_frame; - // Returns a number of neighbors based on a `callback` function. - // - // `_find_neighbors` calls `callback` for each agent in the `agents` array that lie within - // the radius around the owning agent and adds one to the count if its `callback` returns true. - // @tags - virtual }; #endif