mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-12-24 05:37:15 +01:00
Move comments from the top of the addon's scripts down under extends and class_name to make absolutely sure that my c++ convererter script doesn't choke on it.
This commit is contained in:
parent
a9df2d5842
commit
eaa2475279
@ -1,8 +1,9 @@
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIKinematicBody2DAgent
|
||||
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a KinematicBody2D
|
||||
# @category - Specialized agents
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIKinematicBody2DAgent
|
||||
|
||||
# SLIDE uses `move_and_slide`
|
||||
# COLLIDE uses `move_and_collide`
|
||||
|
@ -1,8 +1,9 @@
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIKinematicBody3DAgent
|
||||
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a KinematicBody
|
||||
# @category - Specialized agents
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIKinematicBody3DAgent
|
||||
|
||||
# SLIDE uses `move_and_slide`
|
||||
# COLLIDE uses `move_and_collide`
|
||||
|
@ -1,8 +1,9 @@
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIRigidBody2DAgent
|
||||
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a RigidBody2D
|
||||
# @category - Specialized agents
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIRigidBody2DAgent
|
||||
|
||||
# The RigidBody2D to keep track of
|
||||
var body : RigidBody2D setget _set_body
|
||||
|
@ -1,8 +1,9 @@
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIRigidBody3DAgent
|
||||
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a RigidBody
|
||||
# @category - Specialized agents
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIRigidBody3DAgent
|
||||
|
||||
# The RigidBody to keep track of
|
||||
var body: RigidBody setget _set_body
|
||||
|
@ -1,9 +1,10 @@
|
||||
extends GSAISteeringAgent
|
||||
class_name GSAISpecializedAgent
|
||||
|
||||
# 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
|
||||
extends GSAISteeringAgent
|
||||
class_name GSAISpecializedAgent
|
||||
|
||||
# If `true`, calculates linear and angular velocities based on the previous
|
||||
# frame. When `false`, the user must keep those values updated.
|
||||
|
@ -1,8 +1,9 @@
|
||||
class_name GSAIArrive
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# Calculates acceleration to take an agent to its target's location. The
|
||||
# calculation attempts to arrive with zero remaining velocity.
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIArrive
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# Target agent to arrive to.
|
||||
var target : GSAIAgentLocation
|
||||
|
@ -1,8 +1,9 @@
|
||||
class_name GSAIAvoidCollisions
|
||||
extends GSAIGroupBehavior
|
||||
|
||||
# Steers the agent to avoid obstacles in its path. Approximates obstacles as
|
||||
# spheres.
|
||||
# @category - Group behaviors
|
||||
class_name GSAIAvoidCollisions
|
||||
extends GSAIGroupBehavior
|
||||
|
||||
var _first_neighbor: GSAISteeringAgent
|
||||
var _shortest_time : float = 0.0
|
||||
|
@ -1,3 +1,6 @@
|
||||
class_name GSAIBlend
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# Blends multiple steering behaviors into one, and returns a weighted
|
||||
# acceleration from their calculations.
|
||||
#
|
||||
@ -7,8 +10,6 @@
|
||||
# weight : float
|
||||
# }
|
||||
# @category - Combination behaviors
|
||||
class_name GSAIBlend
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
var _behaviors : Array = Array()
|
||||
var _accel : GSAITargetAcceleration = GSAITargetAcceleration.new()
|
||||
|
@ -1,8 +1,9 @@
|
||||
class_name GSAICohesion
|
||||
extends GSAIGroupBehavior
|
||||
|
||||
# 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
|
||||
class_name GSAICohesion
|
||||
extends GSAIGroupBehavior
|
||||
|
||||
var _center_of_mass: Vector3
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
# Calculates acceleration to take an agent away from where a target agent is
|
||||
# moving.
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIEvade
|
||||
extends GSAIPursue
|
||||
|
||||
# Calculates acceleration to take an agent away from where a target agent is
|
||||
# moving.
|
||||
# @category - Individual behaviors
|
||||
|
||||
func _get_modified_acceleration() -> float:
|
||||
return -agent.linear_acceleration_max
|
||||
|
@ -1,8 +1,9 @@
|
||||
class_name GSAIFace
|
||||
extends GSAIMatchOrientation
|
||||
|
||||
# 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
|
||||
class_name GSAIFace
|
||||
extends GSAIMatchOrientation
|
||||
|
||||
func face(acceleration: GSAITargetAcceleration, target_position: Vector3) -> void:
|
||||
call("_face", acceleration, target_position)
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Calculates acceleration to take an agent directly away from a target agent.
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIFlee
|
||||
extends GSAISeek
|
||||
|
||||
# Calculates acceleration to take an agent directly away from a target agent.
|
||||
# @category - Individual behaviors
|
||||
|
||||
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
acceleration.linear = ((agent.position - target.position).normalized() * agent.linear_acceleration_max)
|
||||
|
@ -1,8 +1,9 @@
|
||||
# Produces a linear acceleration that moves the agent along the specified path.
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIFollowPath
|
||||
extends GSAIArrive
|
||||
|
||||
# Produces a linear acceleration that moves the agent along the specified path.
|
||||
# @category - Individual behaviors
|
||||
|
||||
# The path to follow and travel along.
|
||||
var path : GSAIPath
|
||||
# The distance along the path to generate the next target position.
|
||||
|
@ -1,9 +1,9 @@
|
||||
# Calculates an angular acceleration to match an agent's orientation to its
|
||||
# direction of travel.
|
||||
# @category - Individual behaviors
|
||||
class_name GSAILookWhereYouGo
|
||||
extends GSAIMatchOrientation
|
||||
|
||||
# Calculates an angular acceleration to match an agent's orientation to its
|
||||
# direction of travel.
|
||||
# @category - Individual behaviors
|
||||
|
||||
func _calculate_steering(accel: GSAITargetAcceleration) -> void:
|
||||
if agent.linear_velocity.length_squared() < agent.zero_linear_speed_threshold:
|
||||
|
@ -1,9 +1,10 @@
|
||||
class_name GSAIMatchOrientation
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# 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
|
||||
class_name GSAIMatchOrientation
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# The target orientation for the behavior to try and match rotations to.
|
||||
var target : GSAIAgentLocation
|
||||
|
@ -1,8 +1,9 @@
|
||||
class_name GSAIPriority
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# Container for multiple behaviors that returns the result of the first child
|
||||
# behavior with non-zero acceleration.
|
||||
# @category - Combination behaviors
|
||||
class_name GSAIPriority
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# If a behavior's acceleration is lower than this threshold, the container
|
||||
# considers it has an acceleration of zero.
|
||||
|
@ -1,8 +1,9 @@
|
||||
class_name GSAIPursue
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# Calculates an acceleration to make an agent intercept another based on the
|
||||
# target agent's movement.
|
||||
# @category - Individual behaviors
|
||||
class_name GSAIPursue
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# The target agent that the behavior is trying to intercept.
|
||||
var target : GSAISteeringAgent
|
||||
|
@ -1,8 +1,9 @@
|
||||
class_name GSAISeek
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# Calculates an acceleration to take an agent to a target agent's position
|
||||
# directly.
|
||||
# @category - Individual behaviors
|
||||
class_name GSAISeek
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# The target that the behavior aims to move the agent to.
|
||||
var target : GSAIAgentLocation
|
||||
|
@ -1,3 +1,6 @@
|
||||
class_name GSAISeparation
|
||||
extends GSAIGroupBehavior
|
||||
|
||||
# Calculates an acceleration that repels the agent from its neighbors in the
|
||||
# given `GSAIProximity`.
|
||||
#
|
||||
@ -5,8 +8,6 @@
|
||||
# strength decreasing by the inverse square law in relation to distance, and it
|
||||
# accumulates.
|
||||
# @category - Group behaviors
|
||||
class_name GSAISeparation
|
||||
extends GSAIGroupBehavior
|
||||
|
||||
# The coefficient to calculate how fast the separation strength decays with distance.
|
||||
var decay_coefficient : float = 1.0
|
||||
|
@ -1,8 +1,9 @@
|
||||
# Represents an agent with only a location and an orientation.
|
||||
# @category - Base types
|
||||
extends Reference
|
||||
class_name GSAIAgentLocation
|
||||
|
||||
# Represents an agent with only a location and an orientation.
|
||||
# @category - Base types
|
||||
|
||||
# The agent's position in space.
|
||||
var position : Vector3 = Vector3.ZERO
|
||||
# The agent's orientation on its Y axis rotation.
|
||||
|
@ -1,8 +1,9 @@
|
||||
# Base type for group-based steering behaviors.
|
||||
# @category - Base types
|
||||
class_name GSAIGroupBehavior
|
||||
extends GSAISteeringBehavior
|
||||
|
||||
# Base type for group-based steering behaviors.
|
||||
# @category - Base types
|
||||
|
||||
# Container to find neighbors of the agent and calculate group behavior.
|
||||
var proximity : GSAIProximity
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
class_name GSAIPath
|
||||
extends Reference
|
||||
|
||||
# Represents a path made up of Vector3 waypoints, split into segments path
|
||||
# follow behaviors can use.
|
||||
# @category - Base types
|
||||
class_name GSAIPath
|
||||
extends Reference
|
||||
|
||||
# If `false`, the path loops.
|
||||
var is_open : bool
|
||||
|
@ -1,10 +1,11 @@
|
||||
extends GSAIAgentLocation
|
||||
class_name GSAISteeringAgent
|
||||
|
||||
# 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
|
||||
extends GSAIAgentLocation
|
||||
class_name GSAISteeringAgent
|
||||
|
||||
# The amount of velocity to be considered effectively not moving.
|
||||
var zero_linear_speed_threshold : float = 0.01
|
||||
|
@ -1,3 +1,6 @@
|
||||
extends Reference
|
||||
class_name GSAISteeringBehavior
|
||||
|
||||
# Base class for all steering behaviors.
|
||||
#
|
||||
# Steering behaviors calculate the linear and the angular acceleration to be
|
||||
@ -6,8 +9,6 @@
|
||||
# The `calculate_steering` function is the entry point for all behaviors.
|
||||
# Individual steering behaviors encapsulate the steering logic.
|
||||
# @category - Base types
|
||||
extends Reference
|
||||
class_name GSAISteeringBehavior
|
||||
|
||||
# If `false`, all calculations return zero amounts of acceleration.
|
||||
var is_enabled : bool = true
|
||||
|
@ -1,8 +1,9 @@
|
||||
extends Reference
|
||||
class_name GSAITargetAcceleration
|
||||
|
||||
# A desired linear and angular amount of acceleration requested by the steering
|
||||
# system.
|
||||
# @category - Base types
|
||||
extends Reference
|
||||
class_name GSAITargetAcceleration
|
||||
|
||||
# Linear acceleration
|
||||
var linear : Vector3 = Vector3.ZERO
|
||||
|
@ -1,6 +1,7 @@
|
||||
class_name GSAIUtils
|
||||
|
||||
# Math and vector utility functions.
|
||||
# @Category - Utilities
|
||||
class_name GSAIUtils
|
||||
|
||||
# Returns the `vector` with its length capped to `limit`.
|
||||
static func clampedv3(vector: Vector3, limit: float) -> Vector3:
|
||||
|
@ -1,9 +1,9 @@
|
||||
# Determines any agent that is in the specified list as being neighbors with the
|
||||
# owner agent, regardless of distance.
|
||||
# @category - Proximities
|
||||
extends GSAIProximity
|
||||
class_name GSAIInfiniteProximity
|
||||
|
||||
# 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.
|
||||
#
|
||||
|
@ -1,8 +1,9 @@
|
||||
extends Reference
|
||||
class_name GSAIProximity
|
||||
|
||||
# Base container type that stores data to find the neighbors of an agent.
|
||||
# @category - Proximities
|
||||
# @tags - abstract
|
||||
extends Reference
|
||||
class_name GSAIProximity
|
||||
|
||||
# The owning agent whose neighbors are found in the group
|
||||
var agent : GSAISteeringAgent
|
||||
|
@ -1,8 +1,9 @@
|
||||
extends GSAIProximity
|
||||
class_name GSAIRadiusProximity
|
||||
|
||||
# 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
|
||||
extends GSAIProximity
|
||||
class_name GSAIRadiusProximity
|
||||
|
||||
# The radius around the owning agent to find neighbors in
|
||||
var radius : float = 0.0
|
||||
|
Loading…
Reference in New Issue
Block a user