start with swarm units
This commit is contained in:
parent
19cc3a1888
commit
5301cfa598
@ -1 +0,0 @@
|
||||
|
||||
@ -1 +0,0 @@
|
||||
extends Node3D
|
||||
@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bwo12me8h21q5"]
|
||||
|
||||
[ext_resource type="Script" path="res://swarm_engine/swarm_engine_debug_level.gd" id="1_f0ttr"]
|
||||
[ext_resource type="PackedScene" uid="uid://cn2xvs2g7box5" path="res://swarm_engine/flow_field_navigation/flow_field_navigation.tscn" id="1_xwcpn"]
|
||||
[ext_resource type="PackedScene" uid="uid://cdau7qryen3uq" path="res://swarm_engine/swarm_unit/swarm_unit.tscn" id="3_6kohq"]
|
||||
[ext_resource type="PackedScene" uid="uid://dycbdcrwsm6wu" path="res://experimente/felox/player.tscn" id="6_wayso"]
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_3dwe5"]
|
||||
@ -11,7 +11,6 @@ size = Vector2(400, 400)
|
||||
points = PackedVector3Array(-200, 0, -200, -200, 0, 200, 200, 0, -200, 200, 0, 200)
|
||||
|
||||
[node name="World" type="Node3D"]
|
||||
script = ExtResource("1_f0ttr")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
|
||||
@ -48,3 +47,25 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3.50529)
|
||||
[node name="Camera3D" type="Camera3D" parent="player"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 10, 8)
|
||||
|
||||
[node name="Node3D" type="Node3D" parent="."]
|
||||
|
||||
[node name="SwarmUnit" parent="Node3D" node_paths=PackedStringArray("flow_field_navigation") instance=ExtResource("3_6kohq")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0338392, 0, -41.7085)
|
||||
move_speed = 4
|
||||
flow_field_navigation = NodePath("../../FlowFieldNavigation")
|
||||
|
||||
[node name="SwarmUnit2" parent="Node3D" node_paths=PackedStringArray("flow_field_navigation") instance=ExtResource("3_6kohq")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -17.4426, 0, -41.7085)
|
||||
move_speed = 4
|
||||
flow_field_navigation = NodePath("../../FlowFieldNavigation")
|
||||
|
||||
[node name="SwarmUnit3" parent="Node3D" node_paths=PackedStringArray("flow_field_navigation") instance=ExtResource("3_6kohq")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0338392, 0, -58.7671)
|
||||
move_speed = 4
|
||||
flow_field_navigation = NodePath("../../FlowFieldNavigation")
|
||||
|
||||
[node name="SwarmUnit4" parent="Node3D" node_paths=PackedStringArray("flow_field_navigation") instance=ExtResource("3_6kohq")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -17.4426, 0, -58.7671)
|
||||
move_speed = 4
|
||||
flow_field_navigation = NodePath("../../FlowFieldNavigation")
|
||||
|
||||
10
swarm_engine/swarm_unit/swarm_unit.gd
Normal file
10
swarm_engine/swarm_unit/swarm_unit.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends CharacterBody3D
|
||||
|
||||
@export var move_speed = 2
|
||||
@export var flow_field_navigation: FlowFieldNav
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var flow_direction = flow_field_navigation.get_direction_from_position(position)
|
||||
if flow_direction.length() > 0.0:
|
||||
var movement = flow_direction.normalized() * move_speed * delta
|
||||
position += movement
|
||||
Loading…
Reference in New Issue
Block a user