mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-12-24 05:37:15 +01:00
Prefix the gdscript classes with GD, so they can be easily opened in the same engine. Also added quick launch script.
This commit is contained in:
parent
8ac2c60a4d
commit
7529794925
@ -1,9 +1,9 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
var agent := GSAIKinematicBody2DAgent.new()
|
||||
var target := GSAIAgentLocation.new()
|
||||
var arrive := GSAIArrive.new()
|
||||
var _accel := GSAITargetAcceleration.new()
|
||||
var agent := GDGSAIKinematicBody2DAgent.new()
|
||||
var target := GDGSAIAgentLocation.new()
|
||||
var arrive := GDGSAIArrive.new()
|
||||
var _accel := GDGSAITargetAcceleration.new()
|
||||
|
||||
var _velocity := Vector2()
|
||||
var _drag := 0.1
|
||||
|
@ -12,6 +12,6 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _draw():
|
||||
var target_position := GSAIUtils.to_vector2(arriver.target.position)
|
||||
var target_position := GDGSAIUtils.to_vector2(arriver.target.position)
|
||||
draw_circle(target_position, owner.deceleration_radius, deceleration_radius_color)
|
||||
draw_circle(target_position, owner.arrival_tolerance, arrival_tolerance_color)
|
||||
|
@ -2,28 +2,28 @@ extends KinematicBody
|
||||
|
||||
var target_node: Spatial
|
||||
|
||||
var agent : GSAIKinematicBody3DAgent = null
|
||||
var target : GSAIAgentLocation = null
|
||||
var accel : GSAITargetAcceleration = null
|
||||
var blend : GSAIBlend = null
|
||||
var face : GSAIFace = null
|
||||
var arrive : GSAIArrive = null
|
||||
var agent : GDGSAIKinematicBody3DAgent = null
|
||||
var target : GDGSAIAgentLocation = null
|
||||
var accel : GDGSAITargetAcceleration = null
|
||||
var blend : GDGSAIBlend = null
|
||||
var face : GDGSAIFace = null
|
||||
var arrive : GDGSAIArrive = null
|
||||
|
||||
func _init() -> void:
|
||||
agent = GSAIKinematicBody3DAgent.new()
|
||||
agent = GDGSAIKinematicBody3DAgent.new()
|
||||
agent.body = self
|
||||
|
||||
target = GSAIAgentLocation.new()
|
||||
accel = GSAITargetAcceleration.new()
|
||||
blend = GSAIBlend.new()
|
||||
target = GDGSAIAgentLocation.new()
|
||||
accel = GDGSAITargetAcceleration.new()
|
||||
blend = GDGSAIBlend.new()
|
||||
blend.agent = agent
|
||||
|
||||
face = GSAIFace.new()
|
||||
face = GDGSAIFace.new()
|
||||
face.agent = agent
|
||||
face.target = target
|
||||
face.use_z = true
|
||||
|
||||
arrive = GSAIArrive.new()
|
||||
arrive = GDGSAIArrive.new()
|
||||
arrive.agent = agent
|
||||
arrive.target = target
|
||||
|
||||
|
@ -5,39 +5,39 @@ var draw_proximity: bool
|
||||
var _boundary_right: float
|
||||
var _boundary_bottom: float
|
||||
var _radius: float
|
||||
var _accel := GSAITargetAcceleration.new()
|
||||
var _accel := GDGSAITargetAcceleration.new()
|
||||
var _velocity := Vector2.ZERO
|
||||
var _direction := Vector2()
|
||||
var _drag := 0.1
|
||||
var _color := Color(0.4, 1.0, 0.89, 0.3)
|
||||
|
||||
onready var collision := $CollisionShape2D
|
||||
var agent :GSAIKinematicBody2DAgent= null
|
||||
var proximity :GSAIRadiusProximity= null
|
||||
var avoid :GSAIAvoidCollisions= null
|
||||
var target :GSAIAgentLocation= null
|
||||
var seek :GSAISeek= null
|
||||
var priority :GSAIPriority= null
|
||||
var agent :GDGSAIKinematicBody2DAgent= null
|
||||
var proximity :GDGSAIRadiusProximity= null
|
||||
var avoid :GDGSAIAvoidCollisions= null
|
||||
var target :GDGSAIAgentLocation= null
|
||||
var seek :GDGSAISeek= null
|
||||
var priority :GDGSAIPriority= null
|
||||
|
||||
func _ready() -> void:
|
||||
agent = GSAIKinematicBody2DAgent.new()
|
||||
agent = GDGSAIKinematicBody2DAgent.new()
|
||||
agent.body = self
|
||||
|
||||
proximity = GSAIRadiusProximity.new()
|
||||
proximity = GDGSAIRadiusProximity.new()
|
||||
proximity.agent = agent
|
||||
proximity.radius = 140
|
||||
|
||||
avoid = GSAIAvoidCollisions.new()
|
||||
avoid = GDGSAIAvoidCollisions.new()
|
||||
avoid.agent = agent
|
||||
avoid.proximity = proximity
|
||||
|
||||
target = GSAIAgentLocation.new()
|
||||
target = GDGSAIAgentLocation.new()
|
||||
|
||||
seek = GSAISeek.new()
|
||||
seek = GDGSAISeek.new()
|
||||
seek.agent = agent
|
||||
seek.target = target
|
||||
|
||||
priority = GSAIPriority.new()
|
||||
priority = GDGSAIPriority.new()
|
||||
priority.agent = agent
|
||||
priority.zero_threshold = 0.0001
|
||||
|
||||
|
@ -2,7 +2,7 @@ extends KinematicBody2D
|
||||
|
||||
var speed: float
|
||||
|
||||
onready var agent := GSAIAgentLocation.new()
|
||||
onready var agent := GDGSAIAgentLocation.new()
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
|
@ -1,9 +1,9 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
var face: GSAIFace
|
||||
var agent := GSAIKinematicBody2DAgent.new()
|
||||
var face: GDGSAIFace
|
||||
var agent := GDGSAIKinematicBody2DAgent.new()
|
||||
|
||||
var _accel := GSAITargetAcceleration.new()
|
||||
var _accel := GDGSAITargetAcceleration.new()
|
||||
var _angular_drag := 0.1
|
||||
var _cannon: Rect2
|
||||
var _color: Color
|
||||
@ -29,13 +29,13 @@ func _draw() -> void:
|
||||
|
||||
|
||||
func setup(
|
||||
player_agent: GSAIAgentLocation,
|
||||
player_agent: GDGSAIAgentLocation,
|
||||
align_tolerance: float,
|
||||
deceleration_radius: float,
|
||||
angular_accel_max: float,
|
||||
angular_speed_max: float
|
||||
) -> void:
|
||||
face = GSAIFace.new()
|
||||
face = GDGSAIFace.new()
|
||||
face.agent = agent
|
||||
face.target = player_agent
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
var _velocity := Vector2.ZERO
|
||||
var _accel := GSAITargetAcceleration.new()
|
||||
var _accel := GDGSAITargetAcceleration.new()
|
||||
var _valid := false
|
||||
var _drag := 0.1
|
||||
|
||||
var agent := GSAIKinematicBody2DAgent.new()
|
||||
var path := GSAIPath.new()
|
||||
var follow := GSAIFollowPath.new()
|
||||
var agent := GDGSAIKinematicBody2DAgent.new()
|
||||
var path := GDGSAIPath.new()
|
||||
var follow := GDGSAIFollowPath.new()
|
||||
|
||||
func _ready() -> void:
|
||||
agent.body = self
|
||||
|
@ -1,11 +1,11 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
var separation: GSAISeparation
|
||||
var cohesion: GSAICohesion
|
||||
var proximity: GSAIRadiusProximity
|
||||
var agent :GSAIKinematicBody2DAgent = null
|
||||
var blend : GSAIBlend = null
|
||||
var acceleration : GSAITargetAcceleration = null
|
||||
var separation: GDGSAISeparation
|
||||
var cohesion: GDGSAICohesion
|
||||
var proximity: GDGSAIRadiusProximity
|
||||
var agent :GDGSAIKinematicBody2DAgent = null
|
||||
var blend : GDGSAIBlend = null
|
||||
var acceleration : GDGSAITargetAcceleration = null
|
||||
var draw_proximity := false
|
||||
|
||||
var _color := Color.red
|
||||
@ -14,13 +14,13 @@ var _velocity := Vector2()
|
||||
onready var collision_shape := $CollisionShape2D
|
||||
|
||||
func _init() -> void:
|
||||
agent = GSAIKinematicBody2DAgent.new()
|
||||
agent = GDGSAIKinematicBody2DAgent.new()
|
||||
agent.body = self
|
||||
|
||||
blend = GSAIBlend.new()
|
||||
blend = GDGSAIBlend.new()
|
||||
blend.agent = agent
|
||||
|
||||
acceleration = GSAITargetAcceleration.new()
|
||||
acceleration = GDGSAITargetAcceleration.new()
|
||||
|
||||
func setup(
|
||||
linear_speed_max: float,
|
||||
@ -37,16 +37,16 @@ func setup(
|
||||
agent.linear_speed_max = linear_speed_max
|
||||
agent.linear_drag_percentage = 0.1
|
||||
|
||||
proximity = GSAIRadiusProximity.new()
|
||||
proximity = GDGSAIRadiusProximity.new()
|
||||
proximity.agent = agent
|
||||
proximity.radius = proximity_radius
|
||||
|
||||
separation = GSAISeparation.new()
|
||||
separation = GDGSAISeparation.new()
|
||||
separation.agent = agent
|
||||
separation.proximity = proximity
|
||||
separation.decay_coefficient = separation_decay_coefficient
|
||||
|
||||
cohesion = GSAICohesion.new()
|
||||
cohesion = GDGSAICohesion.new()
|
||||
cohesion.agent = agent
|
||||
cohesion.proximity = proximity
|
||||
|
||||
|
@ -11,7 +11,7 @@ export var linear_drag := 0.025
|
||||
var _linear_velocity := Vector2()
|
||||
var _angular_velocity := 0.0
|
||||
|
||||
onready var agent := GSAISteeringAgent.new()
|
||||
onready var agent := GDGSAISteeringAgent.new()
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
@ -3,22 +3,22 @@ extends KinematicBody2D
|
||||
|
||||
export var use_seek: bool = false
|
||||
|
||||
var _blend: GSAIBlend
|
||||
var _blend: GDGSAIBlend
|
||||
|
||||
var _linear_drag_coefficient := 0.025
|
||||
var _angular_drag := 0.1
|
||||
var _direction_face := GSAIAgentLocation.new()
|
||||
var _direction_face := GDGSAIAgentLocation.new()
|
||||
|
||||
var agent : GSAIKinematicBody2DAgent= null
|
||||
var accel : GSAITargetAcceleration = null
|
||||
var player_agent : GSAISteeringAgent = null
|
||||
var agent : GDGSAIKinematicBody2DAgent= null
|
||||
var accel : GDGSAITargetAcceleration = null
|
||||
var player_agent : GDGSAISteeringAgent = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
agent = GSAIKinematicBody2DAgent.new()
|
||||
agent = GDGSAIKinematicBody2DAgent.new()
|
||||
agent.body = self
|
||||
|
||||
accel = GSAITargetAcceleration.new()
|
||||
accel = GDGSAITargetAcceleration.new()
|
||||
player_agent = owner.find_node("Player", true, false).agent
|
||||
|
||||
agent.calculate_velocities = false
|
||||
@ -38,36 +38,36 @@ func _physics_process(delta: float) -> void:
|
||||
rotation += agent.angular_velocity * delta
|
||||
|
||||
var linear_velocity := (
|
||||
GSAIUtils.to_vector2(agent.linear_velocity)
|
||||
+ (GSAIUtils.angle_to_vector2(rotation) * -agent.linear_acceleration_max * delta)
|
||||
GDGSAIUtils.to_vector2(agent.linear_velocity)
|
||||
+ (GDGSAIUtils.angle_to_vector2(rotation) * -agent.linear_acceleration_max * delta)
|
||||
)
|
||||
linear_velocity = linear_velocity.clamped(agent.linear_speed_max)
|
||||
linear_velocity = linear_velocity.linear_interpolate(Vector2.ZERO, _linear_drag_coefficient)
|
||||
|
||||
linear_velocity = move_and_slide(linear_velocity)
|
||||
agent.linear_velocity = GSAIUtils.to_vector3(linear_velocity)
|
||||
agent.linear_velocity = GDGSAIUtils.to_vector3(linear_velocity)
|
||||
|
||||
|
||||
func setup(predict_time: float, linear_speed_max: float, linear_accel_max: float) -> void:
|
||||
var behavior: GSAISteeringBehavior
|
||||
var behavior: GDGSAISteeringBehavior
|
||||
if use_seek:
|
||||
behavior = GSAISeek.new()
|
||||
behavior = GDGSAISeek.new()
|
||||
behavior.agent = agent
|
||||
behavior.target = player_agent
|
||||
else:
|
||||
behavior = GSAIPursue.new()
|
||||
behavior = GDGSAIPursue.new()
|
||||
behavior.agent = agent
|
||||
behavior.target = player_agent
|
||||
behavior.predict_time_max = predict_time
|
||||
|
||||
var orient_behavior : GSAIFace = GSAIFace.new()
|
||||
var orient_behavior : GDGSAIFace = GDGSAIFace.new()
|
||||
orient_behavior.agent = agent
|
||||
orient_behavior.target = _direction_face
|
||||
|
||||
orient_behavior.alignment_tolerance = deg2rad(5)
|
||||
orient_behavior.deceleration_radius = deg2rad(30)
|
||||
|
||||
_blend = GSAIBlend.new()
|
||||
_blend = GDGSAIBlend.new()
|
||||
_blend.agent = agent
|
||||
_blend.add_behavior(behavior, 1)
|
||||
_blend.add_behavior(orient_behavior, 1)
|
||||
|
@ -18,52 +18,52 @@ var linear_drag := 0.1
|
||||
var angular_drag := 0.1
|
||||
|
||||
# Holds the linear and angular components calculated by our steering behaviors.
|
||||
var acceleration : GSAITargetAcceleration = null
|
||||
var acceleration : GDGSAITargetAcceleration = null
|
||||
|
||||
onready var current_health := health_max
|
||||
|
||||
# GSAISteeringAgent holds our agent's position, orientation, maximum speed and acceleration.
|
||||
var agent : GSAISteeringAgent = null
|
||||
# GDGSAISteeringAgent holds our agent's position, orientation, maximum speed and acceleration.
|
||||
var agent : GDGSAISteeringAgent = null
|
||||
|
||||
var player: Node = null
|
||||
# This assumes that our player class will keep its own agent updated.
|
||||
var player_agent : GSAISteeringAgent = null
|
||||
var player_agent : GDGSAISteeringAgent = null
|
||||
|
||||
# Proximities represent an area with which an agent can identify where neighbors in its relevant
|
||||
# group are. In our case, the group will feature the player, which will be used to avoid a
|
||||
# collision with them. We use a radius proximity so the player is only relevant inside 100 pixels.
|
||||
var proximity : GSAIRadiusProximity = null
|
||||
var proximity : GDGSAIRadiusProximity = null
|
||||
|
||||
# GSAIBlend combines behaviors together, calculating all of their acceleration together and adding
|
||||
# GDGSAIBlend combines behaviors together, calculating all of their acceleration together and adding
|
||||
# them together, multiplied by a strength. We will have one for fleeing, and one for pursuing,
|
||||
# toggling them depending on the agent's health. Since we want the agent to rotate AND move, then
|
||||
# we aim to blend them together.
|
||||
var flee_blend : GSAIBlend = null
|
||||
var pursue_blend : GSAIBlend = null
|
||||
var flee_blend : GDGSAIBlend = null
|
||||
var pursue_blend : GDGSAIBlend = null
|
||||
|
||||
# GSAIPriority will be the main steering behavior we use. It holds sub-behaviors and will pick the
|
||||
# GDGSAIPriority will be the main steering behavior we use. It holds sub-behaviors and will pick the
|
||||
# first one that returns non-zero acceleration, ignoring any afterwards.
|
||||
var priority : GSAIPriority = null
|
||||
var priority : GDGSAIPriority = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
acceleration = GSAITargetAcceleration.new()
|
||||
agent = GSAISteeringAgent.new()
|
||||
acceleration = GDGSAITargetAcceleration.new()
|
||||
agent = GDGSAISteeringAgent.new()
|
||||
player = get_tree().get_nodes_in_group("Player")[0]
|
||||
player_agent = player.agent
|
||||
|
||||
proximity = GSAIRadiusProximity.new()
|
||||
proximity = GDGSAIRadiusProximity.new()
|
||||
proximity.agent = agent
|
||||
proximity.agents = [ player_agent ]
|
||||
proximity.radius = 100
|
||||
|
||||
flee_blend = GSAIBlend.new()
|
||||
flee_blend = GDGSAIBlend.new()
|
||||
flee_blend.agent = agent
|
||||
|
||||
pursue_blend = GSAIBlend.new()
|
||||
pursue_blend = GDGSAIBlend.new()
|
||||
pursue_blend.agent = agent
|
||||
|
||||
priority = GSAIPriority.new()
|
||||
priority = GDGSAIPriority.new()
|
||||
priority.agent = agent
|
||||
|
||||
# ---------- Configuration for our agent ----------
|
||||
@ -77,26 +77,26 @@ func _ready() -> void:
|
||||
# ---------- Configuration for our behaviors ----------
|
||||
# Pursue will happen while the agent is in good health. It produces acceleration that takes
|
||||
# the agent on an intercept course with the target, predicting its position in the future.
|
||||
var pursue : GSAIPursue = GSAIPursue.new()
|
||||
var pursue : GDGSAIPursue = GDGSAIPursue.new()
|
||||
pursue.agent = agent
|
||||
pursue.target = player_agent
|
||||
pursue.predict_time_max = 1.5
|
||||
|
||||
# Flee will happen while the agent is in bad health, so will start disabled. It produces
|
||||
# acceleration that takes the agent directly away from the target with no prediction.
|
||||
var flee : GSAIFlee = GSAIFlee.new()
|
||||
var flee : GDGSAIFlee = GDGSAIFlee.new()
|
||||
flee.agent = agent
|
||||
flee.target = player_agent
|
||||
|
||||
# AvoidCollision tries to keep the agent from running into any of the neighbors found in its
|
||||
# proximity group. In our case, this will be the player, if they are close enough.
|
||||
var avoid : GSAIAvoidCollisions = GSAIAvoidCollisions.new()
|
||||
var avoid : GDGSAIAvoidCollisions = GDGSAIAvoidCollisions.new()
|
||||
avoid.agent = agent
|
||||
avoid.proximity = proximity
|
||||
|
||||
# Face turns the agent to keep looking towards its target. It will be enabled while the agent
|
||||
# is not fleeing due to low health. It tries to arrive 'on alignment' with 0 remaining velocity.
|
||||
var face : GSAIFace = GSAIFace.new()
|
||||
var face : GDGSAIFace = GDGSAIFace.new()
|
||||
face.agent = agent
|
||||
face.target = player_agent
|
||||
|
||||
@ -108,7 +108,7 @@ func _ready() -> void:
|
||||
|
||||
# LookWhereYouGo turns the agent to keep looking towards its direction of travel. It will only
|
||||
# be enabled while the agent is at low health.
|
||||
var look : GSAILookWhereYouGo = GSAILookWhereYouGo.new()
|
||||
var look : GDGSAILookWhereYouGo = GDGSAILookWhereYouGo.new()
|
||||
look.agent = agent
|
||||
# How close for the agent to be 'aligned', if not exact
|
||||
look.alignment_tolerance = deg2rad(5)
|
||||
|
@ -10,18 +10,18 @@ var velocity := Vector2.ZERO
|
||||
var angular_velocity := 0.0
|
||||
var direction := Vector2.RIGHT
|
||||
|
||||
var agent : GSAISteeringAgent = null
|
||||
var proxy_target : GSAIAgentLocation = null
|
||||
var face : GSAIFace = null
|
||||
var agent : GDGSAISteeringAgent = null
|
||||
var proxy_target : GDGSAIAgentLocation = null
|
||||
var face : GDGSAIFace = null
|
||||
|
||||
onready var accel := GSAITargetAcceleration.new()
|
||||
onready var accel := GDGSAITargetAcceleration.new()
|
||||
onready var bullets := owner.get_node("Bullets")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
agent = GSAISteeringAgent.new()
|
||||
proxy_target = GSAIAgentLocation.new()
|
||||
face = GSAIFace.new()
|
||||
agent = GDGSAISteeringAgent.new()
|
||||
proxy_target = GDGSAIAgentLocation.new()
|
||||
face = GDGSAIFace.new()
|
||||
face.agent = agent
|
||||
face.target = proxy_target
|
||||
|
||||
@ -45,7 +45,7 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
var movement := get_movement()
|
||||
|
||||
direction = GSAIUtils.angle_to_vector2(rotation)
|
||||
direction = GDGSAIUtils.angle_to_vector2(rotation)
|
||||
|
||||
velocity += direction * acceleration_max * movement * delta
|
||||
velocity = velocity.clamped(speed_max)
|
||||
|
@ -2,11 +2,11 @@ extends KinematicBody2D
|
||||
# Class to control the player in basic left/right up/down movement.
|
||||
|
||||
var speed: float
|
||||
onready var agent := GSAIAgentLocation.new()
|
||||
onready var agent := GDGSAIAgentLocation.new()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
agent.position = GSAIUtils.to_vector3(global_position)
|
||||
agent.position = GDGSAIUtils.to_vector3(global_position)
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
@ -16,7 +16,7 @@ func _physics_process(_delta: float) -> void:
|
||||
|
||||
# warning-ignore:return_value_discarded
|
||||
move_and_slide(movement * speed)
|
||||
agent.position = GSAIUtils.to_vector3(global_position)
|
||||
agent.position = GDGSAIUtils.to_vector3(global_position)
|
||||
|
||||
|
||||
func _get_movement() -> Vector2:
|
||||
|
@ -1,28 +1,28 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
var player_agent: GSAIAgentLocation
|
||||
var player_agent: GDGSAIAgentLocation
|
||||
var velocity := Vector2.ZERO
|
||||
var start_speed: float
|
||||
var start_accel: float
|
||||
var use_seek := true
|
||||
|
||||
var agent : GSAIKinematicBody2DAgent = null
|
||||
var accel : GSAITargetAcceleration = null
|
||||
var seek : GSAISeek = null
|
||||
var flee : GSAIFlee = null
|
||||
var agent : GDGSAIKinematicBody2DAgent = null
|
||||
var accel : GDGSAITargetAcceleration = null
|
||||
var seek : GDGSAISeek = null
|
||||
var flee : GDGSAIFlee = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
agent = GSAIKinematicBody2DAgent.new()
|
||||
agent = GDGSAIKinematicBody2DAgent.new()
|
||||
agent.body = self
|
||||
|
||||
accel = GSAITargetAcceleration.new()
|
||||
accel = GDGSAITargetAcceleration.new()
|
||||
|
||||
seek = GSAISeek.new()
|
||||
seek = GDGSAISeek.new()
|
||||
seek.agent = agent
|
||||
seek.target = player_agent
|
||||
|
||||
flee = GSAIFlee.new()
|
||||
flee = GDGSAIFlee.new()
|
||||
flee.agent = agent
|
||||
flee.target = player_agent
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIKinematicBody2DAgent
|
||||
extends GDGSAISpecializedAgent
|
||||
class_name GDGSAIKinematicBody2DAgent
|
||||
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a KinematicBody2D
|
||||
@ -31,7 +31,7 @@ func _body_ready() -> void:
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
# @tags - virtual
|
||||
func _apply_steering(acceleration: GSAITargetAcceleration, delta: float) -> void:
|
||||
func _apply_steering(acceleration: GDGSAITargetAcceleration, delta: float) -> void:
|
||||
applied_steering = true
|
||||
|
||||
if movement_type == MovementType.COLLIDE:
|
||||
@ -53,7 +53,7 @@ func _apply_sliding_steering(accel: Vector3, delta: float) -> void:
|
||||
if !_body.is_inside_tree() or _body.get_tree().paused:
|
||||
return
|
||||
|
||||
var velocity : Vector2 = GSAIUtils.to_vector2(linear_velocity + accel * delta).clamped(linear_speed_max)
|
||||
var velocity : Vector2 = GDGSAIUtils.to_vector2(linear_velocity + accel * delta).clamped(linear_speed_max)
|
||||
|
||||
if apply_linear_drag:
|
||||
velocity = velocity.linear_interpolate(Vector2.ZERO, linear_drag_percentage)
|
||||
@ -61,7 +61,7 @@ func _apply_sliding_steering(accel: Vector3, delta: float) -> void:
|
||||
velocity = _body.move_and_slide(velocity)
|
||||
|
||||
if calculate_velocities:
|
||||
linear_velocity = GSAIUtils.to_vector3(velocity)
|
||||
linear_velocity = GDGSAIUtils.to_vector3(velocity)
|
||||
|
||||
|
||||
func _apply_collide_steering(accel: Vector3, delta: float) -> void:
|
||||
@ -69,12 +69,12 @@ func _apply_collide_steering(accel: Vector3, delta: float) -> void:
|
||||
if !_body:
|
||||
return
|
||||
|
||||
var velocity : Vector3 = GSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
var velocity : Vector3 = GDGSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
if apply_linear_drag:
|
||||
velocity = velocity.linear_interpolate(Vector3.ZERO, linear_drag_percentage)
|
||||
|
||||
# warning-ignore:return_value_discarded
|
||||
_body.move_and_collide(GSAIUtils.to_vector2(velocity) * delta)
|
||||
_body.move_and_collide(GDGSAIUtils.to_vector2(velocity) * delta)
|
||||
|
||||
if calculate_velocities:
|
||||
linear_velocity = velocity
|
||||
@ -85,12 +85,12 @@ func _apply_position_steering(accel: Vector3, delta: float) -> void:
|
||||
if !_body:
|
||||
return
|
||||
|
||||
var velocity : Vector3 = GSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
var velocity : Vector3 = GDGSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
|
||||
if apply_linear_drag:
|
||||
velocity = velocity.linear_interpolate(Vector3.ZERO, linear_drag_percentage)
|
||||
|
||||
_body.global_position += GSAIUtils.to_vector2(velocity) * delta
|
||||
_body.global_position += GDGSAIUtils.to_vector2(velocity) * delta
|
||||
|
||||
if calculate_velocities:
|
||||
linear_velocity = velocity
|
||||
@ -125,7 +125,7 @@ func _set_body(value: KinematicBody2D) -> void:
|
||||
_last_position = value.global_position
|
||||
last_orientation = value.rotation
|
||||
|
||||
position = GSAIUtils.to_vector3(_last_position)
|
||||
position = GDGSAIUtils.to_vector3(_last_position)
|
||||
orientation = last_orientation
|
||||
|
||||
if !had_body:
|
||||
@ -143,14 +143,14 @@ func _on_SceneTree_physics_frame() -> void:
|
||||
var current_position : Vector2 = _body.global_position
|
||||
var current_orientation : float = _body.rotation
|
||||
|
||||
position = GSAIUtils.to_vector3(current_position)
|
||||
position = GDGSAIUtils.to_vector3(current_position)
|
||||
orientation = current_orientation
|
||||
|
||||
if calculate_velocities:
|
||||
if applied_steering:
|
||||
applied_steering = false
|
||||
else:
|
||||
linear_velocity = GSAIUtils.clampedv3(GSAIUtils.to_vector3(current_position - _last_position), linear_speed_max)
|
||||
linear_velocity = GDGSAIUtils.clampedv3(GDGSAIUtils.to_vector3(current_position - _last_position), linear_speed_max)
|
||||
|
||||
if apply_linear_drag:
|
||||
linear_velocity = linear_velocity.linear_interpolate(Vector3.ZERO, linear_drag_percentage)
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIKinematicBody3DAgent
|
||||
extends GDGSAISpecializedAgent
|
||||
class_name GDGSAIKinematicBody3DAgent
|
||||
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a KinematicBody
|
||||
@ -31,7 +31,7 @@ func _body_ready() -> void:
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
# @tags - virtual
|
||||
func _apply_steering(acceleration: GSAITargetAcceleration, delta: float) -> void:
|
||||
func _apply_steering(acceleration: GDGSAITargetAcceleration, delta: float) -> void:
|
||||
applied_steering = true
|
||||
if movement_type == MovementType.COLLIDE:
|
||||
_apply_collide_steering(acceleration.linear, delta)
|
||||
@ -48,7 +48,7 @@ func _apply_sliding_steering(accel: Vector3, delta: float) -> void:
|
||||
if !_body:
|
||||
return
|
||||
|
||||
var velocity : Vector3 = GSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
var velocity : Vector3 = GDGSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
|
||||
if apply_linear_drag:
|
||||
velocity = velocity.linear_interpolate(Vector3.ZERO, linear_drag_percentage)
|
||||
@ -63,7 +63,7 @@ func _apply_collide_steering(accel: Vector3, delta: float) -> void:
|
||||
if !_body:
|
||||
return
|
||||
|
||||
var velocity : Vector3 = GSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
var velocity : Vector3 = GDGSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
|
||||
if apply_linear_drag:
|
||||
velocity = velocity.linear_interpolate(Vector3.ZERO, linear_drag_percentage)
|
||||
@ -79,7 +79,7 @@ func _apply_position_steering(accel: Vector3, delta: float) -> void:
|
||||
if !_body:
|
||||
return
|
||||
|
||||
var velocity : Vector3 = GSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
var velocity : Vector3 = GDGSAIUtils.clampedv3(linear_velocity + accel * delta, linear_speed_max)
|
||||
|
||||
if apply_linear_drag:
|
||||
velocity = velocity.linear_interpolate(Vector3.ZERO, linear_drag_percentage)
|
||||
@ -146,7 +146,7 @@ func _on_SceneTree_physics_frame() -> void:
|
||||
if applied_steering:
|
||||
applied_steering = false
|
||||
else:
|
||||
linear_velocity = GSAIUtils.clampedv3(current_position - _last_position, linear_speed_max)
|
||||
linear_velocity = GDGSAIUtils.clampedv3(current_position - _last_position, linear_speed_max)
|
||||
|
||||
if apply_linear_drag:
|
||||
linear_velocity = linear_velocity.linear_interpolate(Vector3.ZERO, linear_drag_percentage)
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIRigidBody2DAgent
|
||||
extends GDGSAISpecializedAgent
|
||||
class_name GDGSAIRigidBody2DAgent
|
||||
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a RigidBody2D
|
||||
@ -19,16 +19,16 @@ func _body_ready() -> void:
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
# @tags - virtual
|
||||
func _apply_steering(acceleration : GSAITargetAcceleration, _delta : float) -> void:
|
||||
func _apply_steering(acceleration : GDGSAITargetAcceleration, _delta : float) -> void:
|
||||
var _body: RigidBody2D = _body_ref.get_ref()
|
||||
if not _body:
|
||||
return
|
||||
|
||||
applied_steering = true
|
||||
_body.apply_central_impulse(GSAIUtils.to_vector2(acceleration.linear))
|
||||
_body.apply_central_impulse(GDGSAIUtils.to_vector2(acceleration.linear))
|
||||
_body.apply_torque_impulse(acceleration.angular)
|
||||
if calculate_velocities:
|
||||
linear_velocity = GSAIUtils.to_vector3(_body.linear_velocity)
|
||||
linear_velocity = GDGSAIUtils.to_vector3(_body.linear_velocity)
|
||||
angular_velocity = _body.angular_velocity
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ func _set_body(value: RigidBody2D) -> void:
|
||||
_last_position = value.global_position
|
||||
last_orientation = value.rotation
|
||||
|
||||
position = GSAIUtils.to_vector3(_last_position)
|
||||
position = GDGSAIUtils.to_vector3(_last_position)
|
||||
orientation = last_orientation
|
||||
|
||||
if !had_body:
|
||||
@ -65,12 +65,12 @@ func _on_SceneTree_frame() -> void:
|
||||
var current_position : Vector2 = _body.global_position
|
||||
var current_orientation : float = _body.rotation
|
||||
|
||||
position = GSAIUtils.to_vector3(current_position)
|
||||
position = GDGSAIUtils.to_vector3(current_position)
|
||||
orientation = current_orientation
|
||||
|
||||
if calculate_velocities:
|
||||
if applied_steering:
|
||||
applied_steering = false
|
||||
else:
|
||||
linear_velocity = GSAIUtils.to_vector3(_body.linear_velocity)
|
||||
linear_velocity = GDGSAIUtils.to_vector3(_body.linear_velocity)
|
||||
angular_velocity = _body.angular_velocity
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends GSAISpecializedAgent
|
||||
class_name GSAIRigidBody3DAgent
|
||||
extends GDGSAISpecializedAgent
|
||||
class_name GDGSAIRigidBody3DAgent
|
||||
|
||||
# A specialized steering agent that updates itself every frame so the user does
|
||||
# not have to using a RigidBody
|
||||
@ -18,7 +18,7 @@ func _body_ready() -> void:
|
||||
|
||||
# Moves the agent's `body` by target `acceleration`.
|
||||
# @tags - virtual
|
||||
func _apply_steering(acceleration: GSAITargetAcceleration, _delta: float) -> void:
|
||||
func _apply_steering(acceleration: GDGSAITargetAcceleration, _delta: float) -> void:
|
||||
var _body: RigidBody = _body_ref.get_ref()
|
||||
if !_body:
|
||||
return
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends GSAISteeringAgent
|
||||
class_name GSAISpecializedAgent
|
||||
extends GDGSAISteeringAgent
|
||||
class_name GDGSAISpecializedAgent
|
||||
|
||||
# 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.
|
||||
@ -33,10 +33,10 @@ var angular_drag_percentage : float = 0.0
|
||||
var last_orientation : float = 0.0
|
||||
var applied_steering : bool = false
|
||||
|
||||
func apply_steering(_acceleration : GSAITargetAcceleration, _delta : float) -> void:
|
||||
func apply_steering(_acceleration : GDGSAITargetAcceleration, _delta : float) -> void:
|
||||
call("_apply_steering", _acceleration, _delta)
|
||||
|
||||
# Moves the agent's body by target `acceleration`.
|
||||
# @tags - virtual
|
||||
func _apply_steering(_acceleration : GSAITargetAcceleration, _delta : float) -> void:
|
||||
func _apply_steering(_acceleration : GDGSAITargetAcceleration, _delta : float) -> void:
|
||||
pass
|
||||
|
@ -1,12 +1,12 @@
|
||||
class_name GSAIArrive
|
||||
extends GSAISteeringBehavior
|
||||
class_name GDGSAIArrive
|
||||
extends GDGSAISteeringBehavior
|
||||
|
||||
# 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
|
||||
var target : GDGSAIAgentLocation
|
||||
# Distance from the target for the agent to be considered successfully
|
||||
# arrived.
|
||||
var arrival_tolerance : float = 0.0
|
||||
@ -15,10 +15,10 @@ 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:
|
||||
func arrive(acceleration : GDGSAITargetAcceleration, target_position : Vector3) -> void:
|
||||
call("_arrive", acceleration, target_position)
|
||||
|
||||
func _arrive(acceleration : GSAITargetAcceleration, target_position : Vector3) -> void:
|
||||
func _arrive(acceleration : GDGSAITargetAcceleration, target_position : Vector3) -> void:
|
||||
var to_target : Vector3 = target_position - agent.position
|
||||
var distance : float = to_target.length()
|
||||
|
||||
@ -34,8 +34,8 @@ func _arrive(acceleration : GSAITargetAcceleration, target_position : Vector3) -
|
||||
|
||||
desired_velocity = ((desired_velocity - agent.linear_velocity) * 1.0 / time_to_reach)
|
||||
|
||||
acceleration.linear = GSAIUtils.clampedv3(desired_velocity, agent.linear_acceleration_max)
|
||||
acceleration.linear = GDGSAIUtils.clampedv3(desired_velocity, agent.linear_acceleration_max)
|
||||
acceleration.angular = 0
|
||||
|
||||
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
arrive(acceleration, target.position)
|
||||
|
@ -1,18 +1,18 @@
|
||||
class_name GSAIAvoidCollisions
|
||||
extends GSAIGroupBehavior
|
||||
class_name GDGSAIAvoidCollisions
|
||||
extends GDGSAIGroupBehavior
|
||||
|
||||
# Steers the agent to avoid obstacles in its path. Approximates obstacles as
|
||||
# spheres.
|
||||
# @category - Group behaviors
|
||||
|
||||
var _first_neighbor: GSAISteeringAgent
|
||||
var _first_neighbor: GDGSAISteeringAgent
|
||||
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:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
_shortest_time = INF
|
||||
_first_neighbor = null
|
||||
_first_minimum_separation = 0
|
||||
@ -35,7 +35,7 @@ func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
# 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:
|
||||
func _report_neighbor(neighbor: GDGSAISteeringAgent) -> 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()
|
||||
|
@ -1,21 +1,21 @@
|
||||
class_name GSAIBlend
|
||||
extends GSAISteeringBehavior
|
||||
class_name GDGSAIBlend
|
||||
extends GDGSAISteeringBehavior
|
||||
|
||||
# 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,
|
||||
# behavior : GDGSAISteeringBehavior,
|
||||
# weight : float
|
||||
# }
|
||||
# @category - Combination behaviors
|
||||
|
||||
var _behaviors : Array = Array()
|
||||
var _accel : GSAITargetAcceleration = GSAITargetAcceleration.new()
|
||||
var _accel : GDGSAITargetAcceleration = GDGSAITargetAcceleration.new()
|
||||
|
||||
# Appends a behavior to the internal array along with its `weight`.
|
||||
func add_behavior(behavior : GSAISteeringBehavior, weight : float) -> void:
|
||||
func add_behavior(behavior : GDGSAISteeringBehavior, weight : float) -> void:
|
||||
behavior.agent = agent
|
||||
|
||||
var dict : Dictionary = Dictionary()
|
||||
@ -48,10 +48,10 @@ func remove_behavior(index : int) -> void:
|
||||
func get_behaviour_count() -> int:
|
||||
return _behaviors.size()
|
||||
|
||||
func get_accel() -> GSAITargetAcceleration:
|
||||
func get_accel() -> GDGSAITargetAcceleration:
|
||||
return _accel
|
||||
|
||||
func _calculate_steering(blended_accel: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(blended_accel: GDGSAITargetAcceleration) -> void:
|
||||
blended_accel.set_zero()
|
||||
|
||||
for i in range(_behaviors.size()):
|
||||
@ -60,5 +60,5 @@ func _calculate_steering(blended_accel: GSAITargetAcceleration) -> void:
|
||||
|
||||
blended_accel.add_scaled_accel(_accel, bw.weight)
|
||||
|
||||
blended_accel.linear = GSAIUtils.clampedv3(blended_accel.linear, agent.linear_acceleration_max)
|
||||
blended_accel.linear = GDGSAIUtils.clampedv3(blended_accel.linear, agent.linear_acceleration_max)
|
||||
blended_accel.angular = clamp(blended_accel.angular, -agent.angular_acceleration_max, agent.angular_acceleration_max)
|
||||
|
@ -1,14 +1,14 @@
|
||||
class_name GSAICohesion
|
||||
extends GSAIGroupBehavior
|
||||
class_name GDGSAICohesion
|
||||
extends GDGSAIGroupBehavior
|
||||
|
||||
# Calculates an acceleration that attempts to move the agent towards the center
|
||||
# of mass of the agents in the area defined by the `GSAIProximity`.
|
||||
# of mass of the agents in the area defined by the `GDGSAIProximity`.
|
||||
# @category - Group behaviors
|
||||
|
||||
var _center_of_mass: Vector3
|
||||
|
||||
|
||||
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
acceleration.set_zero()
|
||||
_center_of_mass = Vector3.ZERO
|
||||
|
||||
@ -21,6 +21,6 @@ func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
# 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:
|
||||
func _report_neighbor(neighbor: GDGSAISteeringAgent) -> bool:
|
||||
_center_of_mass += neighbor.position
|
||||
return true
|
||||
|
@ -1,5 +1,5 @@
|
||||
class_name GSAIEvade
|
||||
extends GSAIPursue
|
||||
class_name GDGSAIEvade
|
||||
extends GDGSAIPursue
|
||||
|
||||
# Calculates acceleration to take an agent away from where a target agent is
|
||||
# moving.
|
||||
|
@ -1,14 +1,14 @@
|
||||
class_name GSAIFace
|
||||
extends GSAIMatchOrientation
|
||||
class_name GDGSAIFace
|
||||
extends GDGSAIMatchOrientation
|
||||
|
||||
# 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:
|
||||
func face(acceleration: GDGSAITargetAcceleration, target_position: Vector3) -> void:
|
||||
call("_face", acceleration, target_position)
|
||||
|
||||
func _face(acceleration: GSAITargetAcceleration, target_position: Vector3) -> void:
|
||||
func _face(acceleration: GDGSAITargetAcceleration, target_position: Vector3) -> void:
|
||||
var to_target : Vector3 = target_position - agent.position
|
||||
var distance_squared : float = to_target.length_squared()
|
||||
|
||||
@ -18,11 +18,11 @@ func _face(acceleration: GSAITargetAcceleration, target_position: Vector3) -> vo
|
||||
var orientation : float
|
||||
|
||||
if use_z:
|
||||
orientation = GSAIUtils.vector3_to_angle(to_target)
|
||||
orientation = GDGSAIUtils.vector3_to_angle(to_target)
|
||||
else:
|
||||
orientation = GSAIUtils.vector2_to_angle(GSAIUtils.to_vector2(to_target))
|
||||
orientation = GDGSAIUtils.vector2_to_angle(GDGSAIUtils.to_vector2(to_target))
|
||||
|
||||
match_orientation(acceleration, orientation)
|
||||
|
||||
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
face(acceleration, target.position)
|
||||
|
@ -1,9 +1,9 @@
|
||||
class_name GSAIFlee
|
||||
extends GSAISeek
|
||||
class_name GDGSAIFlee
|
||||
extends GDGSAISeek
|
||||
|
||||
# Calculates acceleration to take an agent directly away from a target agent.
|
||||
# @category - Individual behaviors
|
||||
|
||||
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
acceleration.linear = ((agent.position - target.position).normalized() * agent.linear_acceleration_max)
|
||||
acceleration.angular = 0
|
||||
|
@ -1,22 +1,22 @@
|
||||
class_name GSAIFollowPath
|
||||
extends GSAIArrive
|
||||
class_name GDGSAIFollowPath
|
||||
extends GDGSAIArrive
|
||||
|
||||
# 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
|
||||
var path : GDGSAIPath
|
||||
# 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.
|
||||
# Whether to use `GDGSAIArrive` 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:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
var location : Vector3
|
||||
|
||||
if prediction_time == 0:
|
||||
|
@ -1,19 +1,19 @@
|
||||
class_name GSAILookWhereYouGo
|
||||
extends GSAIMatchOrientation
|
||||
class_name GDGSAILookWhereYouGo
|
||||
extends GDGSAIMatchOrientation
|
||||
|
||||
# Calculates an angular acceleration to match an agent's orientation to its
|
||||
# direction of travel.
|
||||
# @category - Individual behaviors
|
||||
|
||||
func _calculate_steering(accel: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(accel: GDGSAITargetAcceleration) -> 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)
|
||||
orientation = GDGSAIUtils.vector3_to_angle(agent.linear_velocity)
|
||||
else:
|
||||
orientation = GSAIUtils.vector2_to_angle(GSAIUtils.to_vector2(agent.linear_velocity))
|
||||
orientation = GDGSAIUtils.vector2_to_angle(GDGSAIUtils.to_vector2(agent.linear_velocity))
|
||||
|
||||
match_orientation(accel, orientation)
|
||||
|
@ -1,5 +1,5 @@
|
||||
class_name GSAIMatchOrientation
|
||||
extends GSAISteeringBehavior
|
||||
class_name GDGSAIMatchOrientation
|
||||
extends GDGSAISteeringBehavior
|
||||
|
||||
# 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
|
||||
@ -7,7 +7,7 @@ extends GSAISteeringBehavior
|
||||
# @category - Individual behaviors
|
||||
|
||||
# The target orientation for the behavior to try and match rotations to.
|
||||
var target : GSAIAgentLocation
|
||||
var target : GDGSAIAgentLocation
|
||||
# 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
|
||||
@ -19,10 +19,10 @@ var time_to_reach : float = 0.1
|
||||
# determining angles. X and Z should be used in 3D.
|
||||
var use_z : bool = false
|
||||
|
||||
func match_orientation(acceleration: GSAITargetAcceleration, desired_orientation: float) -> void:
|
||||
func match_orientation(acceleration: GDGSAITargetAcceleration, desired_orientation: float) -> void:
|
||||
call("_match_orientation", acceleration, desired_orientation)
|
||||
|
||||
func _match_orientation(acceleration: GSAITargetAcceleration, desired_orientation: float) -> void:
|
||||
func _match_orientation(acceleration: GDGSAITargetAcceleration, desired_orientation: float) -> void:
|
||||
var rotation : float = wrapf(desired_orientation - agent.orientation, -PI, PI)
|
||||
|
||||
var rotation_size : float = abs(rotation)
|
||||
@ -46,5 +46,5 @@ func _match_orientation(acceleration: GSAITargetAcceleration, desired_orientatio
|
||||
acceleration.linear = Vector3.ZERO
|
||||
|
||||
|
||||
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
match_orientation(acceleration, target.orientation)
|
||||
|
@ -1,5 +1,5 @@
|
||||
class_name GSAIPriority
|
||||
extends GSAISteeringBehavior
|
||||
class_name GDGSAIPriority
|
||||
extends GDGSAISteeringBehavior
|
||||
|
||||
# Container for multiple behaviors that returns the result of the first child
|
||||
# behavior with non-zero acceleration.
|
||||
@ -14,12 +14,12 @@ 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:
|
||||
func add_behavior(behavior: GDGSAISteeringBehavior) -> 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:
|
||||
func get_behavior(index : int) -> GDGSAISteeringBehavior:
|
||||
if _behaviors.size() > index:
|
||||
return _behaviors[index]
|
||||
|
||||
@ -41,7 +41,7 @@ func get_behaviour_count() -> int:
|
||||
return _behaviors.size()
|
||||
|
||||
|
||||
func _calculate_steering(accel : GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(accel : GDGSAITargetAcceleration) -> void:
|
||||
var threshold_squared : float = zero_threshold * zero_threshold
|
||||
|
||||
_last_selected_index = -1
|
||||
@ -51,7 +51,7 @@ func _calculate_steering(accel : GSAITargetAcceleration) -> void:
|
||||
if size > 0:
|
||||
for i in range(size):
|
||||
_last_selected_index = i
|
||||
var behavior: GSAISteeringBehavior = _behaviors[i]
|
||||
var behavior: GDGSAISteeringBehavior = _behaviors[i]
|
||||
behavior.calculate_steering(accel)
|
||||
|
||||
if accel.get_magnitude_squared() > threshold_squared:
|
||||
|
@ -1,17 +1,17 @@
|
||||
class_name GSAIPursue
|
||||
extends GSAISteeringBehavior
|
||||
class_name GDGSAIPursue
|
||||
extends GDGSAISteeringBehavior
|
||||
|
||||
# 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
|
||||
var target : GDGSAISteeringAgent
|
||||
# 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:
|
||||
func _calculate_steering(acceleration : GDGSAITargetAcceleration) -> void:
|
||||
var target_position : Vector3 = target.position
|
||||
var distance_squared : float = (target_position - agent.position).length_squared()
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
class_name GSAISeek
|
||||
extends GSAISteeringBehavior
|
||||
class_name GDGSAISeek
|
||||
extends GDGSAISteeringBehavior
|
||||
|
||||
# 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
|
||||
var target : GDGSAIAgentLocation
|
||||
|
||||
|
||||
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
acceleration.linear = ((target.position - agent.position).normalized() * agent.linear_acceleration_max)
|
||||
acceleration.angular = 0
|
||||
|
@ -1,8 +1,8 @@
|
||||
class_name GSAISeparation
|
||||
extends GSAIGroupBehavior
|
||||
class_name GDGSAISeparation
|
||||
extends GDGSAIGroupBehavior
|
||||
|
||||
# Calculates an acceleration that repels the agent from its neighbors in the
|
||||
# given `GSAIProximity`.
|
||||
# given `GDGSAIProximity`.
|
||||
#
|
||||
# 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
|
||||
@ -12,10 +12,10 @@ extends GSAIGroupBehavior
|
||||
# The coefficient to calculate how fast the separation strength decays with distance.
|
||||
var decay_coefficient : float = 1.0
|
||||
|
||||
var acceleration : GSAITargetAcceleration
|
||||
var acceleration : GDGSAITargetAcceleration
|
||||
|
||||
|
||||
func _calculate_steering(_acceleration : GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(_acceleration : GDGSAITargetAcceleration) -> void:
|
||||
self.acceleration = _acceleration
|
||||
acceleration.set_zero()
|
||||
# warning-ignore:return_value_discarded
|
||||
@ -25,7 +25,7 @@ func _calculate_steering(_acceleration : GSAITargetAcceleration) -> void:
|
||||
# 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:
|
||||
func _report_neighbor(neighbor : GDGSAISteeringAgent) -> bool:
|
||||
var to_agent : Vector3 = agent.position - neighbor.position
|
||||
|
||||
var distance_squared : float = to_agent.length_squared()
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends Reference
|
||||
class_name GSAIAgentLocation
|
||||
class_name GDGSAIAgentLocation
|
||||
|
||||
# Represents an agent with only a location and an orientation.
|
||||
# @category - Base types
|
||||
|
@ -1,11 +1,11 @@
|
||||
class_name GSAIGroupBehavior
|
||||
extends GSAISteeringBehavior
|
||||
class_name GDGSAIGroupBehavior
|
||||
extends GDGSAISteeringBehavior
|
||||
|
||||
# Base type for group-based steering behaviors.
|
||||
# @category - Base types
|
||||
|
||||
# Container to find neighbors of the agent and calculate group behavior.
|
||||
var proximity : GSAIProximity
|
||||
var proximity : GDGSAIProximity
|
||||
|
||||
var _callback : FuncRef = funcref(self, "_report_neighbor")
|
||||
|
||||
@ -15,5 +15,5 @@ func get_callback() -> FuncRef:
|
||||
# Internal callback for the behavior to define whether or not a member is
|
||||
# relevant
|
||||
# @tags - virtual
|
||||
func _report_neighbor(_neighbor : GSAISteeringAgent) -> bool:
|
||||
func _report_neighbor(_neighbor : GDGSAISteeringAgent) -> bool:
|
||||
return false
|
||||
|
@ -1,4 +1,4 @@
|
||||
class_name GSAIPath
|
||||
class_name GDGSAIPath
|
||||
extends Reference
|
||||
|
||||
# Represents a path made up of Vector3 waypoints, split into segments path
|
||||
@ -43,7 +43,7 @@ func create_path(waypoints : Array) -> void:
|
||||
else:
|
||||
current = waypoints[0]
|
||||
|
||||
var segment : GSAISegment = GSAISegment.new(previous, current)
|
||||
var segment : GDGSAISegment = GDGSAISegment.new(previous, current)
|
||||
length += segment.length
|
||||
segment.cumulative_length = length
|
||||
_segments.append(segment)
|
||||
@ -55,10 +55,10 @@ func calculate_distance(agent_current_position : Vector3) -> float:
|
||||
return 0.0
|
||||
|
||||
var smallest_distance_squared : float = INF
|
||||
var nearest_segment : GSAISegment = null
|
||||
var nearest_segment : GDGSAISegment = null
|
||||
|
||||
for i in range(_segments.size()):
|
||||
var segment: GSAISegment = _segments[i]
|
||||
var segment: GDGSAISegment = _segments[i]
|
||||
var distance_squared : float = _calculate_point_segment_distance_squared(segment.begin, segment.end, agent_current_position)
|
||||
|
||||
if distance_squared < smallest_distance_squared:
|
||||
@ -81,9 +81,9 @@ func calculate_target_position(target_distance: float) -> Vector3:
|
||||
elif target_distance > length:
|
||||
target_distance = fmod(target_distance, length)
|
||||
|
||||
var desired_segment: GSAISegment
|
||||
var desired_segment: GDGSAISegment
|
||||
for i in range(_segments.size()):
|
||||
var segment: GSAISegment = _segments[i]
|
||||
var segment: GDGSAISegment = _segments[i]
|
||||
if segment.cumulative_length >= target_distance:
|
||||
desired_segment = segment
|
||||
break
|
||||
@ -117,7 +117,7 @@ func _calculate_point_segment_distance_squared(start: Vector3, end: Vector3, pos
|
||||
return _nearest_point_on_segment.distance_squared_to(position)
|
||||
|
||||
# not exposed helper struct
|
||||
class GSAISegment:
|
||||
class GDGSAISegment:
|
||||
var begin: Vector3
|
||||
var end: Vector3
|
||||
var length: float
|
||||
|
@ -1,7 +1,7 @@
|
||||
extends GSAIAgentLocation
|
||||
class_name GSAISteeringAgent
|
||||
extends GDGSAIAgentLocation
|
||||
class_name GDGSAISteeringAgent
|
||||
|
||||
# Adds velocity, speed, and size data to `GSAIAgentLocation`.
|
||||
# Adds velocity, speed, and size data to `GDGSAIAgentLocation`.
|
||||
#
|
||||
# It is the character's responsibility to keep this information up to date for
|
||||
# the steering toolkit to work correctly.
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends Reference
|
||||
class_name GSAISteeringBehavior
|
||||
class_name GDGSAISteeringBehavior
|
||||
|
||||
# Base class for all steering behaviors.
|
||||
#
|
||||
@ -13,14 +13,14 @@ class_name GSAISteeringBehavior
|
||||
# If `false`, all calculations return zero amounts of acceleration.
|
||||
var is_enabled : bool = true
|
||||
# The AI agent on which the steering behavior bases its calculations.
|
||||
var agent : GSAISteeringAgent
|
||||
var agent : GDGSAISteeringAgent
|
||||
|
||||
# Sets the `acceleration` with the behavior's desired amount of acceleration.
|
||||
func calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
func calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
if is_enabled:
|
||||
call("_calculate_steering", acceleration)
|
||||
else:
|
||||
acceleration.set_zero()
|
||||
|
||||
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
|
||||
func _calculate_steering(acceleration: GDGSAITargetAcceleration) -> void:
|
||||
acceleration.set_zero()
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends Reference
|
||||
class_name GSAITargetAcceleration
|
||||
class_name GDGSAITargetAcceleration
|
||||
|
||||
# A desired linear and angular amount of acceleration requested by the steering
|
||||
# system.
|
||||
@ -18,7 +18,7 @@ func set_zero() -> void:
|
||||
angular = 0.0
|
||||
|
||||
# Adds `accel`'s components, multiplied by `scalar`, to this one.
|
||||
func add_scaled_accel(accel: GSAITargetAcceleration, scalar: float) -> void:
|
||||
func add_scaled_accel(accel: GDGSAITargetAcceleration, scalar: float) -> void:
|
||||
linear += accel.linear * scalar
|
||||
angular += accel.angular * scalar
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class_name GSAIUtils
|
||||
class_name GDGSAIUtils
|
||||
|
||||
# Math and vector utility functions.
|
||||
# @Category - Utilities
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends GSAIProximity
|
||||
class_name GSAIInfiniteProximity
|
||||
extends GDGSAIProximity
|
||||
class_name GDGSAIInfiniteProximity
|
||||
|
||||
# Determines any agent that is in the specified list as being neighbors with the
|
||||
# owner agent, regardless of distance.
|
||||
@ -14,7 +14,7 @@ func _find_neighbors(callback: FuncRef) -> int:
|
||||
var neighbor_count : int = 0
|
||||
var agent_count : int = agents.size()
|
||||
for i in range(agent_count):
|
||||
var current_agent : GSAISteeringAgent = agents[i] as GSAISteeringAgent
|
||||
var current_agent : GDGSAISteeringAgent = agents[i] as GDGSAISteeringAgent
|
||||
|
||||
if current_agent != agent:
|
||||
if callback.call_func(current_agent):
|
||||
|
@ -1,12 +1,12 @@
|
||||
extends Reference
|
||||
class_name GSAIProximity
|
||||
class_name GDGSAIProximity
|
||||
|
||||
# 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
|
||||
var agent : GSAISteeringAgent
|
||||
var agent : GDGSAISteeringAgent
|
||||
# The agents who are part of this group and could be potential neighbors
|
||||
var agents : Array = Array()
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends GSAIProximity
|
||||
class_name GSAIRadiusProximity
|
||||
extends GDGSAIProximity
|
||||
class_name GDGSAIRadiusProximity
|
||||
|
||||
# Determines any agent that is in the specified list as being neighbors with the owner agent if
|
||||
# they lie within the specified radius.
|
||||
@ -37,7 +37,7 @@ func _find_neighbors(callback : FuncRef) -> int:
|
||||
var owner_position : Vector3 = agent.position
|
||||
|
||||
for i in range(agent_count):
|
||||
var current_agent : GSAISteeringAgent = agents[i] as GSAISteeringAgent
|
||||
var current_agent : GDGSAISteeringAgent = agents[i] as GDGSAISteeringAgent
|
||||
|
||||
if current_agent != agent:
|
||||
var distance_squared : float = owner_position.distance_squared_to(current_agent.position)
|
||||
@ -53,7 +53,7 @@ func _find_neighbors(callback : FuncRef) -> int:
|
||||
current_agent.is_tagged = false
|
||||
else:
|
||||
for i in range(agent_count):
|
||||
var current_agent : GSAISteeringAgent = agents[i] as GSAISteeringAgent
|
||||
var current_agent : GDGSAISteeringAgent = agents[i] as GDGSAISteeringAgent
|
||||
|
||||
if current_agent != agent and current_agent.is_tagged:
|
||||
if callback.call_func(current_agent):
|
||||
|
@ -15,181 +15,181 @@ _global_script_classes=[ {
|
||||
"path": "res://Demos/DemoPickerUI.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "GSAIAgentLocation",
|
||||
"class": "GDGSAIAgentLocation",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIAgentLocation.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": "GSAIArrive",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": "GDGSAIArrive",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIArrive.gd"
|
||||
}, {
|
||||
"base": "GSAIGroupBehavior",
|
||||
"class": "GSAIAvoidCollisions",
|
||||
"base": "GDGSAIGroupBehavior",
|
||||
"class": "GDGSAIAvoidCollisions",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": "GSAIBlend",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": "GDGSAIBlend",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd"
|
||||
}, {
|
||||
"base": "GSAIGroupBehavior",
|
||||
"class": "GSAICohesion",
|
||||
"base": "GDGSAIGroupBehavior",
|
||||
"class": "GDGSAICohesion",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd"
|
||||
}, {
|
||||
"base": "GSAIPursue",
|
||||
"class": "GSAIEvade",
|
||||
"base": "GDGSAIPursue",
|
||||
"class": "GDGSAIEvade",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIEvade.gd"
|
||||
}, {
|
||||
"base": "GSAIMatchOrientation",
|
||||
"class": "GSAIFace",
|
||||
"base": "GDGSAIMatchOrientation",
|
||||
"class": "GDGSAIFace",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFace.gd"
|
||||
}, {
|
||||
"base": "GSAISeek",
|
||||
"class": "GSAIFlee",
|
||||
"base": "GDGSAISeek",
|
||||
"class": "GDGSAIFlee",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFlee.gd"
|
||||
}, {
|
||||
"base": "GSAIArrive",
|
||||
"class": "GSAIFollowPath",
|
||||
"base": "GDGSAIArrive",
|
||||
"class": "GDGSAIFollowPath",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFollowPath.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": "GSAIGroupBehavior",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": "GDGSAIGroupBehavior",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIGroupBehavior.gd"
|
||||
}, {
|
||||
"base": "GSAIProximity",
|
||||
"class": "GSAIInfiniteProximity",
|
||||
"base": "GDGSAIProximity",
|
||||
"class": "GDGSAIInfiniteProximity",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIInfiniteProximity.gd"
|
||||
}, {
|
||||
"base": "GSAISpecializedAgent",
|
||||
"class": "GSAIKinematicBody2DAgent",
|
||||
"base": "GDGSAISpecializedAgent",
|
||||
"class": "GDGSAIKinematicBody2DAgent",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody2DAgent.gd"
|
||||
}, {
|
||||
"base": "GSAISpecializedAgent",
|
||||
"class": "GSAIKinematicBody3DAgent",
|
||||
"base": "GDGSAISpecializedAgent",
|
||||
"class": "GDGSAIKinematicBody3DAgent",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody3DAgent.gd"
|
||||
}, {
|
||||
"base": "GSAIMatchOrientation",
|
||||
"class": "GSAILookWhereYouGo",
|
||||
"base": "GDGSAIMatchOrientation",
|
||||
"class": "GDGSAILookWhereYouGo",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAILookWhereYouGo.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": "GSAIMatchOrientation",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": "GDGSAIMatchOrientation",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIMatchOrientation.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "GSAIPath",
|
||||
"class": "GDGSAIPath",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIPath.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": "GSAIPriority",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": "GDGSAIPriority",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPriority.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "GSAIProximity",
|
||||
"class": "GDGSAIProximity",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIProximity.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": "GSAIPursue",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": "GDGSAIPursue",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPursue.gd"
|
||||
}, {
|
||||
"base": "GSAIProximity",
|
||||
"class": "GSAIRadiusProximity",
|
||||
"base": "GDGSAIProximity",
|
||||
"class": "GDGSAIRadiusProximity",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIRadiusProximity.gd"
|
||||
}, {
|
||||
"base": "GSAISpecializedAgent",
|
||||
"class": "GSAIRigidBody2DAgent",
|
||||
"base": "GDGSAISpecializedAgent",
|
||||
"class": "GDGSAIRigidBody2DAgent",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody2DAgent.gd"
|
||||
}, {
|
||||
"base": "GSAISpecializedAgent",
|
||||
"class": "GSAIRigidBody3DAgent",
|
||||
"base": "GDGSAISpecializedAgent",
|
||||
"class": "GDGSAIRigidBody3DAgent",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody3DAgent.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": "GSAISeek",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": "GDGSAISeek",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeek.gd"
|
||||
}, {
|
||||
"base": "GSAIGroupBehavior",
|
||||
"class": "GSAISeparation",
|
||||
"base": "GDGSAIGroupBehavior",
|
||||
"class": "GDGSAISeparation",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringAgent",
|
||||
"class": "GSAISpecializedAgent",
|
||||
"base": "GDGSAISteeringAgent",
|
||||
"class": "GDGSAISpecializedAgent",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAISpecializedAgent.gd"
|
||||
}, {
|
||||
"base": "GSAIAgentLocation",
|
||||
"class": "GSAISteeringAgent",
|
||||
"base": "GDGSAIAgentLocation",
|
||||
"class": "GDGSAISteeringAgent",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAISteeringAgent.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "GSAISteeringBehavior",
|
||||
"class": "GDGSAISteeringBehavior",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAISteeringBehavior.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "GSAITargetAcceleration",
|
||||
"class": "GDGSAITargetAcceleration",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAITargetAcceleration.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "GSAIUtils",
|
||||
"class": "GDGSAIUtils",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIUtils.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"DemoPickerUI": "",
|
||||
"GSAIAgentLocation": "",
|
||||
"GSAIArrive": "",
|
||||
"GSAIAvoidCollisions": "",
|
||||
"GSAIBlend": "",
|
||||
"GSAICohesion": "",
|
||||
"GSAIEvade": "",
|
||||
"GSAIFace": "",
|
||||
"GSAIFlee": "",
|
||||
"GSAIFollowPath": "",
|
||||
"GSAIGroupBehavior": "",
|
||||
"GSAIInfiniteProximity": "",
|
||||
"GSAIKinematicBody2DAgent": "",
|
||||
"GSAIKinematicBody3DAgent": "",
|
||||
"GSAILookWhereYouGo": "",
|
||||
"GSAIMatchOrientation": "",
|
||||
"GSAIPath": "",
|
||||
"GSAIPriority": "",
|
||||
"GSAIProximity": "",
|
||||
"GSAIPursue": "",
|
||||
"GSAIRadiusProximity": "",
|
||||
"GSAIRigidBody2DAgent": "",
|
||||
"GSAIRigidBody3DAgent": "",
|
||||
"GSAISeek": "",
|
||||
"GSAISeparation": "",
|
||||
"GSAISpecializedAgent": "",
|
||||
"GSAISteeringAgent": "",
|
||||
"GSAISteeringBehavior": "",
|
||||
"GSAITargetAcceleration": "",
|
||||
"GSAIUtils": ""
|
||||
"GDGSAIAgentLocation": "",
|
||||
"GDGSAIArrive": "",
|
||||
"GDGSAIAvoidCollisions": "",
|
||||
"GDGSAIBlend": "",
|
||||
"GDGSAICohesion": "",
|
||||
"GDGSAIEvade": "",
|
||||
"GDGSAIFace": "",
|
||||
"GDGSAIFlee": "",
|
||||
"GDGSAIFollowPath": "",
|
||||
"GDGSAIGroupBehavior": "",
|
||||
"GDGSAIInfiniteProximity": "",
|
||||
"GDGSAIKinematicBody2DAgent": "",
|
||||
"GDGSAIKinematicBody3DAgent": "",
|
||||
"GDGSAILookWhereYouGo": "",
|
||||
"GDGSAIMatchOrientation": "",
|
||||
"GDGSAIPath": "",
|
||||
"GDGSAIPriority": "",
|
||||
"GDGSAIProximity": "",
|
||||
"GDGSAIPursue": "",
|
||||
"GDGSAIRadiusProximity": "",
|
||||
"GDGSAIRigidBody2DAgent": "",
|
||||
"GDGSAIRigidBody3DAgent": "",
|
||||
"GDGSAISeek": "",
|
||||
"GDGSAISeparation": "",
|
||||
"GDGSAISpecializedAgent": "",
|
||||
"GDGSAISteeringAgent": "",
|
||||
"GDGSAISteeringBehavior": "",
|
||||
"GDGSAITargetAcceleration": "",
|
||||
"GDGSAIUtils": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
@ -15,181 +15,181 @@ _global_script_classes=[ {
|
||||
"path": "res://Demos/DemoPickerUI.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": @"GSAIAgentLocation",
|
||||
"class": @"GDGSAIAgentLocation",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIAgentLocation.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": @"GSAIArrive",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": @"GDGSAIArrive",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIArrive.gd"
|
||||
}, {
|
||||
"base": "GSAIGroupBehavior",
|
||||
"class": @"GSAIAvoidCollisions",
|
||||
"base": "GDGSAIGroupBehavior",
|
||||
"class": @"GDGSAIAvoidCollisions",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIAvoidCollisions.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": @"GSAIBlend",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": @"GDGSAIBlend",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIBlend.gd"
|
||||
}, {
|
||||
"base": "GSAIGroupBehavior",
|
||||
"class": @"GSAICohesion",
|
||||
"base": "GDGSAIGroupBehavior",
|
||||
"class": @"GDGSAICohesion",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAICohesion.gd"
|
||||
}, {
|
||||
"base": "GSAIPursue",
|
||||
"class": @"GSAIEvade",
|
||||
"base": "GDGSAIPursue",
|
||||
"class": @"GDGSAIEvade",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIEvade.gd"
|
||||
}, {
|
||||
"base": "GSAIMatchOrientation",
|
||||
"class": @"GSAIFace",
|
||||
"base": "GDGSAIMatchOrientation",
|
||||
"class": @"GDGSAIFace",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFace.gd"
|
||||
}, {
|
||||
"base": "GSAISeek",
|
||||
"class": @"GSAIFlee",
|
||||
"base": "GDGSAISeek",
|
||||
"class": @"GDGSAIFlee",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFlee.gd"
|
||||
}, {
|
||||
"base": "GSAIArrive",
|
||||
"class": @"GSAIFollowPath",
|
||||
"base": "GDGSAIArrive",
|
||||
"class": @"GDGSAIFollowPath",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFollowPath.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": @"GSAIGroupBehavior",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": @"GDGSAIGroupBehavior",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIGroupBehavior.gd"
|
||||
}, {
|
||||
"base": "GSAIProximity",
|
||||
"class": @"GSAIInfiniteProximity",
|
||||
"base": "GDGSAIProximity",
|
||||
"class": @"GDGSAIInfiniteProximity",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIInfiniteProximity.gd"
|
||||
}, {
|
||||
"base": "GSAISpecializedAgent",
|
||||
"class": @"GSAIKinematicBody2DAgent",
|
||||
"base": "GDGSAISpecializedAgent",
|
||||
"class": @"GDGSAIKinematicBody2DAgent",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody2DAgent.gd"
|
||||
}, {
|
||||
"base": "GSAISpecializedAgent",
|
||||
"class": @"GSAIKinematicBody3DAgent",
|
||||
"base": "GDGSAISpecializedAgent",
|
||||
"class": @"GDGSAIKinematicBody3DAgent",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIKinematicBody3DAgent.gd"
|
||||
}, {
|
||||
"base": "GSAIMatchOrientation",
|
||||
"class": @"GSAILookWhereYouGo",
|
||||
"base": "GDGSAIMatchOrientation",
|
||||
"class": @"GDGSAILookWhereYouGo",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAILookWhereYouGo.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": @"GSAIMatchOrientation",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": @"GDGSAIMatchOrientation",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIMatchOrientation.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": @"GSAIPath",
|
||||
"class": @"GDGSAIPath",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIPath.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": @"GSAIPriority",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": @"GDGSAIPriority",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPriority.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": @"GSAIProximity",
|
||||
"class": @"GDGSAIProximity",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIProximity.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": @"GSAIPursue",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": @"GDGSAIPursue",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPursue.gd"
|
||||
}, {
|
||||
"base": "GSAIProximity",
|
||||
"class": @"GSAIRadiusProximity",
|
||||
"base": "GDGSAIProximity",
|
||||
"class": @"GDGSAIRadiusProximity",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIRadiusProximity.gd"
|
||||
}, {
|
||||
"base": "GSAISpecializedAgent",
|
||||
"class": @"GSAIRigidBody2DAgent",
|
||||
"base": "GDGSAISpecializedAgent",
|
||||
"class": @"GDGSAIRigidBody2DAgent",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody2DAgent.gd"
|
||||
}, {
|
||||
"base": "GSAISpecializedAgent",
|
||||
"class": @"GSAIRigidBody3DAgent",
|
||||
"base": "GDGSAISpecializedAgent",
|
||||
"class": @"GDGSAIRigidBody3DAgent",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAIRigidBody3DAgent.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringBehavior",
|
||||
"class": @"GSAISeek",
|
||||
"base": "GDGSAISteeringBehavior",
|
||||
"class": @"GDGSAISeek",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeek.gd"
|
||||
}, {
|
||||
"base": "GSAIGroupBehavior",
|
||||
"class": @"GSAISeparation",
|
||||
"base": "GDGSAIGroupBehavior",
|
||||
"class": @"GDGSAISeparation",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAISeparation.gd"
|
||||
}, {
|
||||
"base": "GSAISteeringAgent",
|
||||
"class": @"GSAISpecializedAgent",
|
||||
"base": "GDGSAISteeringAgent",
|
||||
"class": @"GDGSAISpecializedAgent",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAISpecializedAgent.gd"
|
||||
}, {
|
||||
"base": "GSAIAgentLocation",
|
||||
"class": @"GSAISteeringAgent",
|
||||
"base": "GDGSAIAgentLocation",
|
||||
"class": @"GDGSAISteeringAgent",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAISteeringAgent.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": @"GSAISteeringBehavior",
|
||||
"class": @"GDGSAISteeringBehavior",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAISteeringBehavior.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": @"GSAITargetAcceleration",
|
||||
"class": @"GDGSAITargetAcceleration",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAITargetAcceleration.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": @"GSAIUtils",
|
||||
"class": @"GDGSAIUtils",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIUtils.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
@"GSAISeparation": "",
|
||||
@"GDGSAIInfiniteProximity": "",
|
||||
@"GDGSAILookWhereYouGo": "",
|
||||
@"GDGSAIRigidBody3DAgent": "",
|
||||
@"DemoPickerUI": "",
|
||||
@"GSAIBlend": "",
|
||||
@"GSAIEvade": "",
|
||||
@"GSAIGroupBehavior": "",
|
||||
@"GSAIPath": "",
|
||||
@"GSAIProximity": "",
|
||||
@"GSAIRadiusProximity": "",
|
||||
@"GSAIFlee": "",
|
||||
@"GSAIPursue": "",
|
||||
@"GSAISpecializedAgent": "",
|
||||
@"GSAIInfiniteProximity": "",
|
||||
@"GSAILookWhereYouGo": "",
|
||||
@"GSAIRigidBody3DAgent": "",
|
||||
@"GSAIAvoidCollisions": "",
|
||||
@"GSAIPriority": "",
|
||||
@"GSAIRigidBody2DAgent": "",
|
||||
@"GSAIArrive": "",
|
||||
@"GSAIKinematicBody3DAgent": "",
|
||||
@"GSAIMatchOrientation": "",
|
||||
@"GSAISteeringBehavior": "",
|
||||
@"GSAITargetAcceleration": "",
|
||||
@"GSAIUtils": "",
|
||||
@"GSAIAgentLocation": "",
|
||||
@"GSAICohesion": "",
|
||||
@"GSAIFollowPath": "",
|
||||
@"GSAIKinematicBody2DAgent": "",
|
||||
@"GSAISeek": "",
|
||||
@"GSAISteeringAgent": "",
|
||||
@"GSAIFace": ""
|
||||
@"GDGSAIAvoidCollisions": "",
|
||||
@"GDGSAIPriority": "",
|
||||
@"GDGSAIRigidBody2DAgent": "",
|
||||
@"GDGSAIArrive": "",
|
||||
@"GDGSAIKinematicBody3DAgent": "",
|
||||
@"GDGSAIMatchOrientation": "",
|
||||
@"GDGSAISteeringBehavior": "",
|
||||
@"GDGSAITargetAcceleration": "",
|
||||
@"GDGSAIUtils": "",
|
||||
@"GDGSAIAgentLocation": "",
|
||||
@"GDGSAICohesion": "",
|
||||
@"GDGSAIFollowPath": "",
|
||||
@"GDGSAIKinematicBody2DAgent": "",
|
||||
@"GDGSAISeek": "",
|
||||
@"GDGSAISteeringAgent": "",
|
||||
@"GDGSAIFace": "",
|
||||
@"GDGSAISeparation": "",
|
||||
@"GDGSAIBlend": "",
|
||||
@"GDGSAIEvade": "",
|
||||
@"GDGSAIGroupBehavior": "",
|
||||
@"GDGSAIPath": "",
|
||||
@"GDGSAIProximity": "",
|
||||
@"GDGSAIRadiusProximity": "",
|
||||
@"GDGSAIFlee": "",
|
||||
@"GDGSAIPursue": "",
|
||||
@"GDGSAISpecializedAgent": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
6
project_gdscript_ged.sh
Executable file
6
project_gdscript_ged.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp -u ./pandemonium_engine/bin/pandemonium.x11.opt.tools.64 ./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64
|
||||
|
||||
export LD_LIBRARY_PATH=`pwd`/pandemonium_engine/bin/
|
||||
./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64 -e --path ./project_gdscript/
|
Loading…
Reference in New Issue
Block a user