From 0c863b099d03e19834d705b5c1d76de5ab7243af Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 14 Jan 2023 10:09:48 +0100 Subject: [PATCH] Updated the engine and removed every class that is now in c++. --- .../Behaviors/GSAIArrive.gd | 41 -------- .../Behaviors/GSAIAvoidCollisions.gd | 63 ------------- .../Behaviors/GSAIBlend.gd | 64 ------------- .../Behaviors/GSAICohesion.gd | 26 ----- .../Behaviors/GSAIEvade.gd | 9 -- .../Behaviors/GSAIFace.gd | 28 ------ .../Behaviors/GSAIFlee.gd | 9 -- .../Behaviors/GSAIFollowPath.gd | 48 ---------- .../Behaviors/GSAILookWhereYouGo.gd | 19 ---- .../Behaviors/GSAIMatchOrientation.gd | 50 ---------- .../Behaviors/GSAIPriority.gd | 60 ------------ .../Behaviors/GSAIPursue.gd | 35 ------- .../Behaviors/GSAISeek.gd | 14 --- .../Behaviors/GSAISeparation.gd | 40 -------- godot/project.pandemonium | 94 +------------------ 15 files changed, 5 insertions(+), 595 deletions(-) delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIArrive.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIEvade.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFace.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFlee.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFollowPath.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAILookWhereYouGo.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIMatchOrientation.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPriority.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPursue.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeek.gd delete mode 100644 godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIArrive.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIArrive.gd deleted file mode 100644 index 8629563..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIArrive.gd +++ /dev/null @@ -1,41 +0,0 @@ -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 - -# Target agent to arrive to. -var target : GSAIAgentLocation -# Distance from the target for the agent to be considered successfully -# arrived. -var arrival_tolerance : float = 0.0 -# Distance from the target for the agent to begin slowing down. -var deceleration_radius : float = 0.0 -# Represents the time it takes to change acceleration. -var time_to_reach : float = 0.1 - -func arrive(acceleration : GSAITargetAcceleration, target_position : Vector3) -> void: - call("_arrive", acceleration, target_position) - -func _arrive(acceleration : GSAITargetAcceleration, target_position : Vector3) -> void: - var to_target : Vector3 = target_position - agent.position - var distance : float = to_target.length() - - if distance <= arrival_tolerance: - acceleration.set_zero() - else: - var desired_speed : float = agent.linear_speed_max - - if distance <= deceleration_radius: - desired_speed *= distance / deceleration_radius - - var desired_velocity : Vector3 = to_target * desired_speed / distance - - desired_velocity = ((desired_velocity - agent.linear_velocity) * 1.0 / time_to_reach) - - acceleration.linear = GSAIUtils.clampedv3(desired_velocity, agent.linear_acceleration_max) - acceleration.angular = 0 - -func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: - arrive(acceleration, target.position) diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd deleted file mode 100644 index a373b36..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd +++ /dev/null @@ -1,63 +0,0 @@ -class_name GSAIAvoidCollisions -extends GSAIGroupBehavior - -# Steers the agent to avoid obstacles in its path. Approximates obstacles as -# spheres. -# @category - Group behaviors - -var _first_neighbor: GSAISteeringAgent -var _shortest_time : float = 0.0 -var _first_minimum_separation : float = 0.0 -var _first_distance : float = 0.0 -var _first_relative_position : Vector3 -var _first_relative_velocity : Vector3 - -func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: - _shortest_time = INF - _first_neighbor = null - _first_minimum_separation = 0 - _first_distance = 0 - - var neighbor_count : int = proximity.find_neighbors(_callback) - - if neighbor_count == 0 or not _first_neighbor: - acceleration.set_zero() - else: - if (_first_minimum_separation <= 0 || _first_distance < agent.bounding_radius + _first_neighbor.bounding_radius): - acceleration.linear = _first_neighbor.position - agent.position - else: - acceleration.linear = (_first_relative_position+ (_first_relative_velocity * _shortest_time)) - - acceleration.linear = (acceleration.linear.normalized() * -agent.linear_acceleration_max) - acceleration.angular = 0 - - -# 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 -func _report_neighbor(neighbor: GSAISteeringAgent) -> bool: - var relative_position : Vector3 = neighbor.position - agent.position - var relative_velocity : Vector3 = neighbor.linear_velocity - agent.linear_velocity - var relative_speed_squared : float = relative_velocity.length_squared() - - if relative_speed_squared == 0: - return false - else: - var time_to_collision : float = -relative_position.dot(relative_velocity) / relative_speed_squared - - if time_to_collision <= 0 || time_to_collision >= _shortest_time: - return false - else: - var distance = relative_position.length() - var minimum_separation: float = (distance - sqrt(relative_speed_squared) * time_to_collision) - - if minimum_separation > agent.bounding_radius + neighbor.bounding_radius: - return false - else: - _shortest_time = time_to_collision - _first_neighbor = neighbor - _first_minimum_separation = minimum_separation - _first_distance = distance - _first_relative_position = relative_position - _first_relative_velocity = relative_velocity - return true diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd deleted file mode 100644 index f14d5a2..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd +++ /dev/null @@ -1,64 +0,0 @@ -class_name GSAIBlend -extends GSAISteeringBehavior - -# Blends multiple steering behaviors into one, and returns a weighted -# acceleration from their calculations. -# -# Stores the behaviors internally as dictionaries of the form -# { -# behavior : GSAISteeringBehavior, -# weight : float -# } -# @category - Combination behaviors - -var _behaviors : Array = Array() -var _accel : GSAITargetAcceleration = GSAITargetAcceleration.new() - -# Appends a behavior to the internal array along with its `weight`. -func add_behavior(behavior : GSAISteeringBehavior, weight : float) -> void: - behavior.agent = agent - - var dict : Dictionary = Dictionary() - - dict["behavior"] = behavior; - dict["weight"] = weight; - - _behaviors.append(dict) - -# Returns the behavior at the specified `index`, or an empty `Dictionary` if -# none was found. -func get_behavior(index : int) -> Dictionary: - if _behaviors.size() > index: - return _behaviors[index] - - printerr("Tried to get index " + str(index) + " in array of size " + str(_behaviors.size())) - - return Dictionary() - -func remove_behavior(index : int) -> void: - if _behaviors.size() > index: - _behaviors.remove(index) - - return - - printerr("Tried to get index " + str(index) + " in array of size " + str(_behaviors.size())) - - return - -func get_behaviour_count() -> int: - return _behaviors.size() - -func get_accel() -> GSAITargetAcceleration: - return _accel - -func _calculate_steering(blended_accel: GSAITargetAcceleration) -> void: - blended_accel.set_zero() - - for i in range(_behaviors.size()): - var bw : Dictionary = _behaviors[i] - bw.behavior.calculate_steering(_accel) - - blended_accel.add_scaled_accel(_accel, bw.weight) - - blended_accel.linear = GSAIUtils.clampedv3(blended_accel.linear, agent.linear_acceleration_max) - blended_accel.angular = clamp(blended_accel.angular, -agent.angular_acceleration_max, agent.angular_acceleration_max) diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd deleted file mode 100644 index 772a894..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd +++ /dev/null @@ -1,26 +0,0 @@ -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 - -var _center_of_mass: Vector3 - - -func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: - acceleration.set_zero() - _center_of_mass = Vector3.ZERO - - var neighbor_count = proximity.find_neighbors(_callback) - if neighbor_count > 0: - _center_of_mass *= 1.0 / neighbor_count - acceleration.linear = ((_center_of_mass - agent.position).normalized() * agent.linear_acceleration_max) - - -# Callback for the proximity to call when finding neighbors. Adds `neighbor`'s position -# to the center of mass of the group. -# @tags - virtual -func _report_neighbor(neighbor: GSAISteeringAgent) -> bool: - _center_of_mass += neighbor.position - return true diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIEvade.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIEvade.gd deleted file mode 100644 index 3b3ed8c..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIEvade.gd +++ /dev/null @@ -1,9 +0,0 @@ -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 diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFace.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFace.gd deleted file mode 100644 index 2ec724a..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFace.gd +++ /dev/null @@ -1,28 +0,0 @@ -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 - -func face(acceleration: GSAITargetAcceleration, target_position: Vector3) -> void: - call("_face", acceleration, target_position) - -func _face(acceleration: GSAITargetAcceleration, target_position: Vector3) -> void: - var to_target : Vector3 = target_position - agent.position - var distance_squared : float = to_target.length_squared() - - if distance_squared < agent.zero_linear_speed_threshold: - acceleration.set_zero() - else: - var orientation : float - - if use_z: - orientation = GSAIUtils.vector3_to_angle(to_target) - else: - orientation = GSAIUtils.vector2_to_angle(GSAIUtils.to_vector2(to_target)) - - match_orientation(acceleration, orientation) - -func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: - face(acceleration, target.position) diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFlee.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFlee.gd deleted file mode 100644 index 8255300..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFlee.gd +++ /dev/null @@ -1,9 +0,0 @@ -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) - acceleration.angular = 0 diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFollowPath.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFollowPath.gd deleted file mode 100644 index ab3a9e1..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFollowPath.gd +++ /dev/null @@ -1,48 +0,0 @@ -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. -var path_offset : float = 0.0 - -# Whether to use `GSAIArrive` behavior on an open path. -var is_arrive_enabled : bool = true -# 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. -var prediction_time : float = 0.0 - - -func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: - var location : Vector3 - - if prediction_time == 0: - location = agent.position - else: - location = agent.position + (agent.linear_velocity * prediction_time) - - var distance : float = path.calculate_distance(location) - var target_distance : float = distance + path_offset - - if prediction_time > 0 and path.is_open: - if target_distance < path.calculate_distance(agent.position): - target_distance = path.length - - var target_position : Vector3 = path.calculate_target_position(target_distance) - - if is_arrive_enabled and path.is_open: - if path_offset >= 0: - if target_distance > path.length - deceleration_radius: - arrive(acceleration, target_position) - return - else: - if target_distance < deceleration_radius: - arrive(acceleration, target_position) - return - - acceleration.linear = (target_position - agent.position).normalized() - acceleration.linear *= agent.linear_acceleration_max - acceleration.angular = 0 diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAILookWhereYouGo.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAILookWhereYouGo.gd deleted file mode 100644 index 07b5175..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAILookWhereYouGo.gd +++ /dev/null @@ -1,19 +0,0 @@ -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: - accel.set_zero() - else: - var orientation : float - - if use_z: - orientation = GSAIUtils.vector3_to_angle(agent.linear_velocity) - else: - orientation = GSAIUtils.vector2_to_angle(GSAIUtils.to_vector2(agent.linear_velocity)) - - match_orientation(accel, orientation) diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIMatchOrientation.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIMatchOrientation.gd deleted file mode 100644 index 2afe5d3..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIMatchOrientation.gd +++ /dev/null @@ -1,50 +0,0 @@ -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 - -# The target orientation for the behavior to try and match rotations to. -var target : GSAIAgentLocation -# The amount of distance in radians for the behavior to consider itself close -# enough to be matching the target agent's rotation. -var alignment_tolerance : float = 0.0 -# The amount of distance in radians from the goal to start slowing down. -var deceleration_radius : float = 0.0 -# The amount of time to reach the target velocity -var time_to_reach : float = 0.1 -# 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. -var use_z : bool = false - -func match_orientation(acceleration: GSAITargetAcceleration, desired_orientation: float) -> void: - call("_match_orientation", acceleration, desired_orientation) - -func _match_orientation(acceleration: GSAITargetAcceleration, desired_orientation: float) -> void: - var rotation : float = wrapf(desired_orientation - agent.orientation, -PI, PI) - - var rotation_size : float = abs(rotation) - - if rotation_size <= alignment_tolerance: - acceleration.set_zero() - else: - var desired_rotation : float = agent.angular_speed_max - - if rotation_size <= deceleration_radius: - desired_rotation *= rotation_size / deceleration_radius - - desired_rotation *= rotation / rotation_size - - acceleration.angular = ((desired_rotation - agent.angular_velocity) / time_to_reach) - - var limited_acceleration : float = abs(acceleration.angular) - if limited_acceleration > agent.angular_acceleration_max: - acceleration.angular *= (agent.angular_acceleration_max / limited_acceleration) - - acceleration.linear = Vector3.ZERO - - -func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: - match_orientation(acceleration, target.orientation) diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPriority.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPriority.gd deleted file mode 100644 index 7b787bb..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPriority.gd +++ /dev/null @@ -1,60 +0,0 @@ -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 - -# If a behavior's acceleration is lower than this threshold, the container -# considers it has an acceleration of zero. -var zero_threshold : float = 0.0 - -# The index of the last behavior the container prioritized. -var _last_selected_index : int = 0 -var _behaviors : Array = Array() - -# Appends a steering behavior as a child of this container. -func add_behavior(behavior: GSAISteeringBehavior) -> void: - _behaviors.append(behavior) - -# Returns the behavior at the position in the pool referred to by `index`, or -# `null` if no behavior was found. -func get_behavior(index : int) -> GSAISteeringBehavior: - if _behaviors.size() > index: - return _behaviors[index] - - printerr("Tried to get index " + str(index) + " in array of size " + str(_behaviors.size())) - - return null - -func remove_behavior(index : int) -> void: - if _behaviors.size() > index: - _behaviors.remove(index) - - return - - printerr("Tried to get index " + str(index) + " in array of size " + str(_behaviors.size())) - - return - -func get_behaviour_count() -> int: - return _behaviors.size() - - -func _calculate_steering(accel : GSAITargetAcceleration) -> void: - var threshold_squared : float = zero_threshold * zero_threshold - - _last_selected_index = -1 - - var size : int = _behaviors.size() - - if size > 0: - for i in range(size): - _last_selected_index = i - var behavior: GSAISteeringBehavior = _behaviors[i] - behavior.calculate_steering(accel) - - if accel.get_magnitude_squared() > threshold_squared: - break - else: - accel.set_zero() diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPursue.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPursue.gd deleted file mode 100644 index b229384..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPursue.gd +++ /dev/null @@ -1,35 +0,0 @@ -class_name GSAIPursue -extends GSAISteeringBehavior - -# 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. -var target : GSAISteeringAgent -# The maximum amount of time in the future the behavior predicts the target's -# location. -var predict_time_max : float = 1.0 - -func _calculate_steering(acceleration : GSAITargetAcceleration) -> void: - var target_position : Vector3 = target.position - var distance_squared : float = (target_position - agent.position).length_squared() - - var speed_squared : float = agent.linear_velocity.length_squared() - var predict_time : float = predict_time_max - - if speed_squared > 0: - var predict_time_squared := distance_squared / speed_squared - if predict_time_squared < predict_time_max * predict_time_max: - predict_time = sqrt(predict_time_squared) - - acceleration.linear = ((target_position + (target.linear_velocity * predict_time)) - agent.position).normalized() - acceleration.linear *= get_modified_acceleration() - - acceleration.angular = 0 - -func get_modified_acceleration() -> float: - return call("_get_modified_acceleration") - -func _get_modified_acceleration() -> float: - return agent.linear_acceleration_max diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeek.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeek.gd deleted file mode 100644 index 8537269..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeek.gd +++ /dev/null @@ -1,14 +0,0 @@ -class_name GSAISeek -extends GSAISteeringBehavior - -# 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. -var target : GSAIAgentLocation - - -func _calculate_steering(acceleration: GSAITargetAcceleration) -> void: - acceleration.linear = ((target.position - agent.position).normalized() * agent.linear_acceleration_max) - acceleration.angular = 0 diff --git a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd b/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd deleted file mode 100644 index 1eacc08..0000000 --- a/godot/addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd +++ /dev/null @@ -1,40 +0,0 @@ -class_name GSAISeparation -extends GSAIGroupBehavior - -# 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. -var decay_coefficient : float = 1.0 - -var acceleration : GSAITargetAcceleration - - -func _calculate_steering(_acceleration : GSAITargetAcceleration) -> void: - self.acceleration = _acceleration - acceleration.set_zero() - # warning-ignore:return_value_discarded - proximity.find_neighbors(_callback) - - -# 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 -func _report_neighbor(neighbor : GSAISteeringAgent) -> bool: - var to_agent : Vector3 = agent.position - neighbor.position - - var distance_squared : float = to_agent.length_squared() - var acceleration_max : float = agent.linear_acceleration_max - - var strength := decay_coefficient / distance_squared - if strength > acceleration_max: - strength = acceleration_max - - acceleration.linear += to_agent * (strength / sqrt(distance_squared)) - - return true diff --git a/godot/project.pandemonium b/godot/project.pandemonium index cc9810d..a43419c 100644 --- a/godot/project.pandemonium +++ b/godot/project.pandemonium @@ -14,46 +14,6 @@ _global_script_classes=[ { "language": @"GDScript", "path": "res://Demos/DemoPickerUI.gd" }, { -"base": "GSAISteeringBehavior", -"class": @"GSAIArrive", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIArrive.gd" -}, { -"base": "GSAIGroupBehavior", -"class": @"GSAIAvoidCollisions", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd" -}, { -"base": "GSAISteeringBehavior", -"class": @"GSAIBlend", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd" -}, { -"base": "GSAIGroupBehavior", -"class": @"GSAICohesion", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd" -}, { -"base": "GSAIPursue", -"class": @"GSAIEvade", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIEvade.gd" -}, { -"base": "GSAIMatchOrientation", -"class": @"GSAIFace", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFace.gd" -}, { -"base": "GSAISeek", -"class": @"GSAIFlee", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFlee.gd" -}, { -"base": "GSAIArrive", -"class": @"GSAIFollowPath", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFollowPath.gd" -}, { "base": "GSAISpecializedAgent", "class": @"GSAIKinematicBody2DAgent", "language": @"GDScript", @@ -64,26 +24,6 @@ _global_script_classes=[ { "language": @"GDScript", "path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody3DAgent.gd" }, { -"base": "GSAIMatchOrientation", -"class": @"GSAILookWhereYouGo", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAILookWhereYouGo.gd" -}, { -"base": "GSAISteeringBehavior", -"class": @"GSAIMatchOrientation", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIMatchOrientation.gd" -}, { -"base": "GSAISteeringBehavior", -"class": @"GSAIPriority", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPriority.gd" -}, { -"base": "GSAISteeringBehavior", -"class": @"GSAIPursue", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPursue.gd" -}, { "base": "GSAISpecializedAgent", "class": @"GSAIRigidBody2DAgent", "language": @"GDScript", @@ -94,42 +34,18 @@ _global_script_classes=[ { "language": @"GDScript", "path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody3DAgent.gd" }, { -"base": "GSAISteeringBehavior", -"class": @"GSAISeek", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeek.gd" -}, { -"base": "GSAIGroupBehavior", -"class": @"GSAISeparation", -"language": @"GDScript", -"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd" -}, { "base": "GSAISteeringAgent", "class": @"GSAISpecializedAgent", "language": @"GDScript", "path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAISpecializedAgent.gd" } ] _global_script_class_icons={ -@"GSAISeparation": "", -@"DemoPickerUI": "", -@"GSAIBlend": "", -@"GSAIEvade": "", -@"GSAIFlee": "", -@"GSAIPursue": "", -@"GSAISpecializedAgent": "", -@"GSAILookWhereYouGo": "", -@"GSAIRigidBody3DAgent": "", -@"GSAIAvoidCollisions": "", -@"GSAIPriority": "", -@"GSAIRigidBody2DAgent": "", -@"GSAIArrive": "", -@"GSAIKinematicBody3DAgent": "", -@"GSAIMatchOrientation": "", -@"GSAICohesion": "", -@"GSAIFollowPath": "", @"GSAIKinematicBody2DAgent": "", -@"GSAISeek": "", -@"GSAIFace": "" +@"GSAIKinematicBody3DAgent": "", +@"GSAIRigidBody2DAgent": "", +@"GSAIRigidBody3DAgent": "", +@"GSAISpecializedAgent": "", +@"DemoPickerUI": "" } [application]