Commit
•
da17ede
1
Parent(s):
dbf0e3a
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +3 -0
- README.md +25 -0
- RobotVolleyball.csproj +11 -0
- RobotVolleyball.sln +19 -0
- addons/godot_rl_agents/controller/ai_controller_2d.gd +113 -0
- addons/godot_rl_agents/controller/ai_controller_3d.gd +114 -0
- addons/godot_rl_agents/godot_rl_agents.gd +16 -0
- addons/godot_rl_agents/icon.png +3 -0
- addons/godot_rl_agents/icon.png.import +34 -0
- addons/godot_rl_agents/onnx/csharp/ONNXInference.cs +103 -0
- addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs +131 -0
- addons/godot_rl_agents/onnx/csharp/docs/ONNXInference.xml +31 -0
- addons/godot_rl_agents/onnx/csharp/docs/SessionConfigurator.xml +29 -0
- addons/godot_rl_agents/onnx/wrapper/ONNX_wrapper.gd +27 -0
- addons/godot_rl_agents/plugin.cfg +7 -0
- addons/godot_rl_agents/sensors/sensors_2d/ExampleRaycastSensor2D.tscn +48 -0
- addons/godot_rl_agents/sensors/sensors_2d/GridSensor2D.gd +235 -0
- addons/godot_rl_agents/sensors/sensors_2d/ISensor2D.gd +25 -0
- addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd +118 -0
- addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.tscn +7 -0
- addons/godot_rl_agents/sensors/sensors_3d/ExampleRaycastSensor3D.tscn +6 -0
- addons/godot_rl_agents/sensors/sensors_3d/GridSensor3D.gd +258 -0
- addons/godot_rl_agents/sensors/sensors_3d/ISensor3D.gd +25 -0
- addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.gd +21 -0
- addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.tscn +41 -0
- addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd +185 -0
- addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.tscn +27 -0
- addons/godot_rl_agents/sync.gd +540 -0
- asset-license.md +5 -0
- blender/grass.png +3 -0
- blender/grass.png.import +35 -0
- blender/grass2.png +3 -0
- blender/grass2.png.import +35 -0
- blender/grass3.png +3 -0
- blender/grass3.png.import +35 -0
- blender/robot.blend +3 -0
- blender/robot.blend.import +50 -0
- blender/static_decorations.blend +3 -0
- blender/static_decorations.blend.import +50 -0
- icon.svg +1 -0
- icon.svg.import +37 -0
- onnx/volleyball.onnx +3 -0
- project.godot +58 -0
- readme.md +63 -0
- scenes/game_scene/ball.gd +34 -0
- scenes/game_scene/game_manager.gd +127 -0
- scenes/game_scene/game_scene.tscn +377 -0
- scenes/game_scene/goal.gd +13 -0
- scenes/robot/RobotAIController.gd +79 -0
- scenes/robot/robot.gd +131 -0
.gitattributes
CHANGED
@@ -53,3 +53,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
blender/robot.blend filter=lfs diff=lfs merge=lfs -text
|
57 |
+
blender/static_decorations.blend filter=lfs diff=lfs merge=lfs -text
|
58 |
+
textures/sky.exr filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: godot-rl
|
3 |
+
tags:
|
4 |
+
- deep-reinforcement-learning
|
5 |
+
- reinforcement-learning
|
6 |
+
- godot-rl
|
7 |
+
- environments
|
8 |
+
- video-games
|
9 |
+
---
|
10 |
+
|
11 |
+
A RL environment called RobotVolleyball for the Godot Game Engine.
|
12 |
+
|
13 |
+
This environment was created with: https://github.com/edbeeching/godot_rl_agents
|
14 |
+
|
15 |
+
|
16 |
+
## Downloading the environment
|
17 |
+
|
18 |
+
After installing Godot RL Agents, download the environment with:
|
19 |
+
|
20 |
+
```
|
21 |
+
gdrl.env_from_hub -r edbeeching/godot_rl_RobotVolleyball
|
22 |
+
```
|
23 |
+
|
24 |
+
|
25 |
+
|
RobotVolleyball.csproj
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<Project Sdk="Godot.NET.Sdk/4.2.1">
|
2 |
+
<PropertyGroup>
|
3 |
+
<TargetFramework>net6.0</TargetFramework>
|
4 |
+
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
|
5 |
+
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
|
6 |
+
<EnableDynamicLoading>true</EnableDynamicLoading>
|
7 |
+
</PropertyGroup>
|
8 |
+
<ItemGroup>
|
9 |
+
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.16.3" />
|
10 |
+
</ItemGroup>
|
11 |
+
</Project>
|
RobotVolleyball.sln
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
2 |
+
# Visual Studio 2012
|
3 |
+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RobotVolleyball", "RobotVolleyball.csproj", "{D16F0B71-2C5E-479E-B683-CBFF6C9F71E7}"
|
4 |
+
EndProject
|
5 |
+
Global
|
6 |
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
7 |
+
Debug|Any CPU = Debug|Any CPU
|
8 |
+
ExportDebug|Any CPU = ExportDebug|Any CPU
|
9 |
+
ExportRelease|Any CPU = ExportRelease|Any CPU
|
10 |
+
EndGlobalSection
|
11 |
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
12 |
+
{D16F0B71-2C5E-479E-B683-CBFF6C9F71E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
13 |
+
{D16F0B71-2C5E-479E-B683-CBFF6C9F71E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
14 |
+
{D16F0B71-2C5E-479E-B683-CBFF6C9F71E7}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
15 |
+
{D16F0B71-2C5E-479E-B683-CBFF6C9F71E7}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
16 |
+
{D16F0B71-2C5E-479E-B683-CBFF6C9F71E7}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
17 |
+
{D16F0B71-2C5E-479E-B683-CBFF6C9F71E7}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
18 |
+
EndGlobalSection
|
19 |
+
EndGlobal
|
addons/godot_rl_agents/controller/ai_controller_2d.gd
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node2D
|
2 |
+
class_name AIController2D
|
3 |
+
|
4 |
+
enum ControlModes { INHERIT_FROM_SYNC, HUMAN, TRAINING, ONNX_INFERENCE, RECORD_EXPERT_DEMOS }
|
5 |
+
@export var control_mode: ControlModes = ControlModes.INHERIT_FROM_SYNC
|
6 |
+
@export var onnx_model_path := ""
|
7 |
+
@export var reset_after := 1000
|
8 |
+
|
9 |
+
@export_group("Record expert demos mode options")
|
10 |
+
## Path where the demos will be saved. The file can later be used for imitation learning.
|
11 |
+
@export var expert_demo_save_path: String
|
12 |
+
## The action that erases the last recorded episode from the currently recorded data.
|
13 |
+
@export var remove_last_episode_key: InputEvent
|
14 |
+
## Action will be repeated for n frames. Will introduce control lag if larger than 1.
|
15 |
+
## Can be used to ensure that action_repeat on inference and training matches
|
16 |
+
## the recorded demonstrations.
|
17 |
+
@export var action_repeat: int = 1
|
18 |
+
|
19 |
+
var onnx_model: ONNXModel
|
20 |
+
|
21 |
+
var heuristic := "human"
|
22 |
+
var done := false
|
23 |
+
var reward := 0.0
|
24 |
+
var n_steps := 0
|
25 |
+
var needs_reset := false
|
26 |
+
|
27 |
+
var _player: Node2D
|
28 |
+
|
29 |
+
|
30 |
+
func _ready():
|
31 |
+
add_to_group("AGENT")
|
32 |
+
|
33 |
+
|
34 |
+
func init(player: Node2D):
|
35 |
+
_player = player
|
36 |
+
|
37 |
+
|
38 |
+
#-- Methods that need implementing using the "extend script" option in Godot --#
|
39 |
+
func get_obs() -> Dictionary:
|
40 |
+
assert(false, "the get_obs method is not implemented when extending from ai_controller")
|
41 |
+
return {"obs": []}
|
42 |
+
|
43 |
+
|
44 |
+
func get_reward() -> float:
|
45 |
+
assert(false, "the get_reward method is not implemented when extending from ai_controller")
|
46 |
+
return 0.0
|
47 |
+
|
48 |
+
|
49 |
+
func get_action_space() -> Dictionary:
|
50 |
+
assert(
|
51 |
+
false,
|
52 |
+
"the get get_action_space method is not implemented when extending from ai_controller"
|
53 |
+
)
|
54 |
+
return {
|
55 |
+
"example_actions_continous": {"size": 2, "action_type": "continuous"},
|
56 |
+
"example_actions_discrete": {"size": 2, "action_type": "discrete"},
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
func set_action(action) -> void:
|
61 |
+
assert(false, "the get set_action method is not implemented when extending from ai_controller")
|
62 |
+
|
63 |
+
|
64 |
+
#-----------------------------------------------------------------------------#
|
65 |
+
|
66 |
+
|
67 |
+
#-- Methods that sometimes need implementing using the "extend script" option in Godot --#
|
68 |
+
# Only needed if you are recording expert demos with this AIController
|
69 |
+
func get_action() -> Array:
|
70 |
+
assert(false, "the get set_action method is not implemented in extended AIController but demo_recorder is used")
|
71 |
+
return []
|
72 |
+
|
73 |
+
# -----------------------------------------------------------------------------#
|
74 |
+
|
75 |
+
func _physics_process(delta):
|
76 |
+
n_steps += 1
|
77 |
+
if n_steps > reset_after:
|
78 |
+
needs_reset = true
|
79 |
+
|
80 |
+
|
81 |
+
func get_obs_space():
|
82 |
+
# may need overriding if the obs space is complex
|
83 |
+
var obs = get_obs()
|
84 |
+
return {
|
85 |
+
"obs": {"size": [len(obs["obs"])], "space": "box"},
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
func reset():
|
90 |
+
n_steps = 0
|
91 |
+
needs_reset = false
|
92 |
+
|
93 |
+
|
94 |
+
func reset_if_done():
|
95 |
+
if done:
|
96 |
+
reset()
|
97 |
+
|
98 |
+
|
99 |
+
func set_heuristic(h):
|
100 |
+
# sets the heuristic from "human" or "model" nothing to change here
|
101 |
+
heuristic = h
|
102 |
+
|
103 |
+
|
104 |
+
func get_done():
|
105 |
+
return done
|
106 |
+
|
107 |
+
|
108 |
+
func set_done_false():
|
109 |
+
done = false
|
110 |
+
|
111 |
+
|
112 |
+
func zero_reward():
|
113 |
+
reward = 0.0
|
addons/godot_rl_agents/controller/ai_controller_3d.gd
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node3D
|
2 |
+
class_name AIController3D
|
3 |
+
|
4 |
+
enum ControlModes { INHERIT_FROM_SYNC, HUMAN, TRAINING, ONNX_INFERENCE, RECORD_EXPERT_DEMOS }
|
5 |
+
@export var control_mode: ControlModes = ControlModes.INHERIT_FROM_SYNC
|
6 |
+
@export var onnx_model_path := ""
|
7 |
+
@export var reset_after := 1000
|
8 |
+
|
9 |
+
@export_group("Record expert demos mode options")
|
10 |
+
## Path where the demos will be saved. The file can later be used for imitation learning.
|
11 |
+
@export var expert_demo_save_path: String
|
12 |
+
## The action that erases the last recorded episode from the currently recorded data.
|
13 |
+
@export var remove_last_episode_key: InputEvent
|
14 |
+
## Action will be repeated for n frames. Will introduce control lag if larger than 1.
|
15 |
+
## Can be used to ensure that action_repeat on inference and training matches
|
16 |
+
## the recorded demonstrations.
|
17 |
+
@export var action_repeat: int = 1
|
18 |
+
|
19 |
+
var onnx_model: ONNXModel
|
20 |
+
|
21 |
+
var heuristic := "human"
|
22 |
+
var done := false
|
23 |
+
var reward := 0.0
|
24 |
+
var n_steps := 0
|
25 |
+
var needs_reset := false
|
26 |
+
|
27 |
+
var _player: Node3D
|
28 |
+
|
29 |
+
|
30 |
+
func _ready():
|
31 |
+
add_to_group("AGENT")
|
32 |
+
|
33 |
+
|
34 |
+
func init(player: Node3D):
|
35 |
+
_player = player
|
36 |
+
|
37 |
+
|
38 |
+
#-- Methods that need implementing using the "extend script" option in Godot --#
|
39 |
+
func get_obs() -> Dictionary:
|
40 |
+
assert(false, "the get_obs method is not implemented when extending from ai_controller")
|
41 |
+
return {"obs": []}
|
42 |
+
|
43 |
+
|
44 |
+
func get_reward() -> float:
|
45 |
+
assert(false, "the get_reward method is not implemented when extending from ai_controller")
|
46 |
+
return 0.0
|
47 |
+
|
48 |
+
|
49 |
+
func get_action_space() -> Dictionary:
|
50 |
+
assert(
|
51 |
+
false,
|
52 |
+
"the get get_action_space method is not implemented when extending from ai_controller"
|
53 |
+
)
|
54 |
+
return {
|
55 |
+
"example_actions_continous": {"size": 2, "action_type": "continuous"},
|
56 |
+
"example_actions_discrete": {"size": 2, "action_type": "discrete"},
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
func set_action(action) -> void:
|
61 |
+
assert(false, "the get set_action method is not implemented when extending from ai_controller")
|
62 |
+
|
63 |
+
|
64 |
+
#-----------------------------------------------------------------------------#
|
65 |
+
|
66 |
+
|
67 |
+
#-- Methods that sometimes need implementing using the "extend script" option in Godot --#
|
68 |
+
# Only needed if you are recording expert demos with this AIController
|
69 |
+
func get_action() -> Array:
|
70 |
+
assert(false, "the get set_action method is not implemented in extended AIController but demo_recorder is used")
|
71 |
+
return []
|
72 |
+
|
73 |
+
# -----------------------------------------------------------------------------#
|
74 |
+
|
75 |
+
|
76 |
+
func _physics_process(delta):
|
77 |
+
n_steps += 1
|
78 |
+
if n_steps > reset_after:
|
79 |
+
needs_reset = true
|
80 |
+
|
81 |
+
|
82 |
+
func get_obs_space():
|
83 |
+
# may need overriding if the obs space is complex
|
84 |
+
var obs = get_obs()
|
85 |
+
return {
|
86 |
+
"obs": {"size": [len(obs["obs"])], "space": "box"},
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
func reset():
|
91 |
+
n_steps = 0
|
92 |
+
needs_reset = false
|
93 |
+
|
94 |
+
|
95 |
+
func reset_if_done():
|
96 |
+
if done:
|
97 |
+
reset()
|
98 |
+
|
99 |
+
|
100 |
+
func set_heuristic(h):
|
101 |
+
# sets the heuristic from "human" or "model" nothing to change here
|
102 |
+
heuristic = h
|
103 |
+
|
104 |
+
|
105 |
+
func get_done():
|
106 |
+
return done
|
107 |
+
|
108 |
+
|
109 |
+
func set_done_false():
|
110 |
+
done = false
|
111 |
+
|
112 |
+
|
113 |
+
func zero_reward():
|
114 |
+
reward = 0.0
|
addons/godot_rl_agents/godot_rl_agents.gd
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@tool
|
2 |
+
extends EditorPlugin
|
3 |
+
|
4 |
+
|
5 |
+
func _enter_tree():
|
6 |
+
# Initialization of the plugin goes here.
|
7 |
+
# Add the new type with a name, a parent type, a script and an icon.
|
8 |
+
add_custom_type("Sync", "Node", preload("sync.gd"), preload("icon.png"))
|
9 |
+
#add_custom_type("RaycastSensor2D2", "Node", preload("raycast_sensor_2d.gd"), preload("icon.png"))
|
10 |
+
|
11 |
+
|
12 |
+
func _exit_tree():
|
13 |
+
# Clean-up of the plugin goes here.
|
14 |
+
# Always remember to remove it from the engine when deactivated.
|
15 |
+
remove_custom_type("Sync")
|
16 |
+
#remove_custom_type("RaycastSensor2D2")
|
addons/godot_rl_agents/icon.png
ADDED
Git LFS Details
|
addons/godot_rl_agents/icon.png.import
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[remap]
|
2 |
+
|
3 |
+
importer="texture"
|
4 |
+
type="CompressedTexture2D"
|
5 |
+
uid="uid://g2osotvjho5v"
|
6 |
+
path="res://.godot/imported/icon.png-45a871b53434e556222f5901d598ab34.ctex"
|
7 |
+
metadata={
|
8 |
+
"vram_texture": false
|
9 |
+
}
|
10 |
+
|
11 |
+
[deps]
|
12 |
+
|
13 |
+
source_file="res://addons/godot_rl_agents/icon.png"
|
14 |
+
dest_files=["res://.godot/imported/icon.png-45a871b53434e556222f5901d598ab34.ctex"]
|
15 |
+
|
16 |
+
[params]
|
17 |
+
|
18 |
+
compress/mode=0
|
19 |
+
compress/high_quality=false
|
20 |
+
compress/lossy_quality=0.7
|
21 |
+
compress/hdr_compression=1
|
22 |
+
compress/normal_map=0
|
23 |
+
compress/channel_pack=0
|
24 |
+
mipmaps/generate=false
|
25 |
+
mipmaps/limit=-1
|
26 |
+
roughness/mode=0
|
27 |
+
roughness/src_normal=""
|
28 |
+
process/fix_alpha_border=true
|
29 |
+
process/premult_alpha=false
|
30 |
+
process/normal_map_invert_y=false
|
31 |
+
process/hdr_as_srgb=false
|
32 |
+
process/hdr_clamp_exposure=false
|
33 |
+
process/size_limit=0
|
34 |
+
detect_3d/compress_to=1
|
addons/godot_rl_agents/onnx/csharp/ONNXInference.cs
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
using Godot;
|
2 |
+
using Microsoft.ML.OnnxRuntime;
|
3 |
+
using Microsoft.ML.OnnxRuntime.Tensors;
|
4 |
+
using System.Collections.Generic;
|
5 |
+
using System.Linq;
|
6 |
+
|
7 |
+
namespace GodotONNX
|
8 |
+
{
|
9 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/ONNXInference/*'/>
|
10 |
+
public partial class ONNXInference : GodotObject
|
11 |
+
{
|
12 |
+
|
13 |
+
private InferenceSession session;
|
14 |
+
/// <summary>
|
15 |
+
/// Path to the ONNX model. Use Initialize to change it.
|
16 |
+
/// </summary>
|
17 |
+
private string modelPath;
|
18 |
+
private int batchSize;
|
19 |
+
|
20 |
+
private SessionOptions SessionOpt;
|
21 |
+
|
22 |
+
//init function
|
23 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Initialize/*'/>
|
24 |
+
public void Initialize(string Path, int BatchSize)
|
25 |
+
{
|
26 |
+
modelPath = Path;
|
27 |
+
batchSize = BatchSize;
|
28 |
+
SessionOpt = SessionConfigurator.MakeConfiguredSessionOptions();
|
29 |
+
session = LoadModel(modelPath);
|
30 |
+
|
31 |
+
}
|
32 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Run/*'/>
|
33 |
+
public Godot.Collections.Dictionary<string, Godot.Collections.Array<float>> RunInference(Godot.Collections.Array<float> obs, int state_ins)
|
34 |
+
{
|
35 |
+
//Current model: Any (Godot Rl Agents)
|
36 |
+
//Expects a tensor of shape [batch_size, input_size] type float named obs and a tensor of shape [batch_size] type float named state_ins
|
37 |
+
|
38 |
+
//Fill the input tensors
|
39 |
+
// create span from inputSize
|
40 |
+
var span = new float[obs.Count]; //There's probably a better way to do this
|
41 |
+
for (int i = 0; i < obs.Count; i++)
|
42 |
+
{
|
43 |
+
span[i] = obs[i];
|
44 |
+
}
|
45 |
+
|
46 |
+
IReadOnlyCollection<NamedOnnxValue> inputs = new List<NamedOnnxValue>
|
47 |
+
{
|
48 |
+
NamedOnnxValue.CreateFromTensor("obs", new DenseTensor<float>(span, new int[] { batchSize, obs.Count })),
|
49 |
+
NamedOnnxValue.CreateFromTensor("state_ins", new DenseTensor<float>(new float[] { state_ins }, new int[] { batchSize }))
|
50 |
+
};
|
51 |
+
IReadOnlyCollection<string> outputNames = new List<string> { "output", "state_outs" }; //ONNX is sensible to these names, as well as the input names
|
52 |
+
|
53 |
+
IDisposableReadOnlyCollection<DisposableNamedOnnxValue> results;
|
54 |
+
//We do not use "using" here so we get a better exception explaination later
|
55 |
+
try
|
56 |
+
{
|
57 |
+
results = session.Run(inputs, outputNames);
|
58 |
+
}
|
59 |
+
catch (OnnxRuntimeException e)
|
60 |
+
{
|
61 |
+
//This error usually means that the model is not compatible with the input, beacause of the input shape (size)
|
62 |
+
GD.Print("Error at inference: ", e);
|
63 |
+
return null;
|
64 |
+
}
|
65 |
+
//Can't convert IEnumerable<float> to Variant, so we have to convert it to an array or something
|
66 |
+
Godot.Collections.Dictionary<string, Godot.Collections.Array<float>> output = new Godot.Collections.Dictionary<string, Godot.Collections.Array<float>>();
|
67 |
+
DisposableNamedOnnxValue output1 = results.First();
|
68 |
+
DisposableNamedOnnxValue output2 = results.Last();
|
69 |
+
Godot.Collections.Array<float> output1Array = new Godot.Collections.Array<float>();
|
70 |
+
Godot.Collections.Array<float> output2Array = new Godot.Collections.Array<float>();
|
71 |
+
|
72 |
+
foreach (float f in output1.AsEnumerable<float>())
|
73 |
+
{
|
74 |
+
output1Array.Add(f);
|
75 |
+
}
|
76 |
+
|
77 |
+
foreach (float f in output2.AsEnumerable<float>())
|
78 |
+
{
|
79 |
+
output2Array.Add(f);
|
80 |
+
}
|
81 |
+
|
82 |
+
output.Add(output1.Name, output1Array);
|
83 |
+
output.Add(output2.Name, output2Array);
|
84 |
+
|
85 |
+
//Output is a dictionary of arrays, ex: { "output" : [0.1, 0.2, 0.3, 0.4, ...], "state_outs" : [0.5, ...]}
|
86 |
+
results.Dispose();
|
87 |
+
return output;
|
88 |
+
}
|
89 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Load/*'/>
|
90 |
+
public InferenceSession LoadModel(string Path)
|
91 |
+
{
|
92 |
+
using Godot.FileAccess file = FileAccess.Open(Path, Godot.FileAccess.ModeFlags.Read);
|
93 |
+
byte[] model = file.GetBuffer((int)file.GetLength());
|
94 |
+
//file.Close(); file.Dispose(); //Close the file, then dispose the reference.
|
95 |
+
return new InferenceSession(model, SessionOpt); //Load the model
|
96 |
+
}
|
97 |
+
public void FreeDisposables()
|
98 |
+
{
|
99 |
+
session.Dispose();
|
100 |
+
SessionOpt.Dispose();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
using Godot;
|
2 |
+
using Microsoft.ML.OnnxRuntime;
|
3 |
+
|
4 |
+
namespace GodotONNX
|
5 |
+
{
|
6 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/SessionConfigurator/*'/>
|
7 |
+
|
8 |
+
public static class SessionConfigurator
|
9 |
+
{
|
10 |
+
public enum ComputeName
|
11 |
+
{
|
12 |
+
CUDA,
|
13 |
+
ROCm,
|
14 |
+
DirectML,
|
15 |
+
CoreML,
|
16 |
+
CPU
|
17 |
+
}
|
18 |
+
|
19 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/GetSessionOptions/*'/>
|
20 |
+
public static SessionOptions MakeConfiguredSessionOptions()
|
21 |
+
{
|
22 |
+
SessionOptions sessionOptions = new();
|
23 |
+
SetOptions(sessionOptions);
|
24 |
+
return sessionOptions;
|
25 |
+
}
|
26 |
+
|
27 |
+
private static void SetOptions(SessionOptions sessionOptions)
|
28 |
+
{
|
29 |
+
sessionOptions.LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_WARNING;
|
30 |
+
ApplySystemSpecificOptions(sessionOptions);
|
31 |
+
}
|
32 |
+
|
33 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/SystemCheck/*'/>
|
34 |
+
static public void ApplySystemSpecificOptions(SessionOptions sessionOptions)
|
35 |
+
{
|
36 |
+
//Most code for this function is verbose only, the only reason it exists is to track
|
37 |
+
//implementation progress of the different compute APIs.
|
38 |
+
|
39 |
+
//December 2022: CUDA is not working.
|
40 |
+
|
41 |
+
string OSName = OS.GetName(); //Get OS Name
|
42 |
+
|
43 |
+
//ComputeName ComputeAPI = ComputeCheck(); //Get Compute API
|
44 |
+
// //TODO: Get CPU architecture
|
45 |
+
|
46 |
+
//Linux can use OpenVINO (C#) on x64 and ROCm on x86 (GDNative/C++)
|
47 |
+
//Windows can use OpenVINO (C#) on x64
|
48 |
+
//TODO: try TensorRT instead of CUDA
|
49 |
+
//TODO: Use OpenVINO for Intel Graphics
|
50 |
+
|
51 |
+
// Temporarily using CPU on all platforms to avoid errors detected with DML
|
52 |
+
ComputeName ComputeAPI = ComputeName.CPU;
|
53 |
+
|
54 |
+
//match OS and Compute API
|
55 |
+
GD.Print($"OS: {OSName} Compute API: {ComputeAPI}");
|
56 |
+
|
57 |
+
// CPU is set by default without appending necessary
|
58 |
+
// sessionOptions.AppendExecutionProvider_CPU(0);
|
59 |
+
|
60 |
+
/*
|
61 |
+
switch (OSName)
|
62 |
+
{
|
63 |
+
case "Windows": //Can use CUDA, DirectML
|
64 |
+
if (ComputeAPI is ComputeName.CUDA)
|
65 |
+
{
|
66 |
+
//CUDA
|
67 |
+
//sessionOptions.AppendExecutionProvider_CUDA(0);
|
68 |
+
//sessionOptions.AppendExecutionProvider_DML(0);
|
69 |
+
}
|
70 |
+
else if (ComputeAPI is ComputeName.DirectML)
|
71 |
+
{
|
72 |
+
//DirectML
|
73 |
+
//sessionOptions.AppendExecutionProvider_DML(0);
|
74 |
+
}
|
75 |
+
break;
|
76 |
+
case "X11": //Can use CUDA, ROCm
|
77 |
+
if (ComputeAPI is ComputeName.CUDA)
|
78 |
+
{
|
79 |
+
//CUDA
|
80 |
+
//sessionOptions.AppendExecutionProvider_CUDA(0);
|
81 |
+
}
|
82 |
+
if (ComputeAPI is ComputeName.ROCm)
|
83 |
+
{
|
84 |
+
//ROCm, only works on x86
|
85 |
+
//Research indicates that this has to be compiled as a GDNative plugin
|
86 |
+
//GD.Print("ROCm not supported yet, using CPU.");
|
87 |
+
//sessionOptions.AppendExecutionProvider_CPU(0);
|
88 |
+
}
|
89 |
+
break;
|
90 |
+
case "macOS": //Can use CoreML
|
91 |
+
if (ComputeAPI is ComputeName.CoreML)
|
92 |
+
{ //CoreML
|
93 |
+
//TODO: Needs testing
|
94 |
+
//sessionOptions.AppendExecutionProvider_CoreML(0);
|
95 |
+
//CoreML on ARM64, out of the box, on x64 needs .tar file from GitHub
|
96 |
+
}
|
97 |
+
break;
|
98 |
+
default:
|
99 |
+
GD.Print("OS not Supported.");
|
100 |
+
break;
|
101 |
+
}
|
102 |
+
*/
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/ComputeCheck/*'/>
|
107 |
+
public static ComputeName ComputeCheck()
|
108 |
+
{
|
109 |
+
string adapterName = Godot.RenderingServer.GetVideoAdapterName();
|
110 |
+
//string adapterVendor = Godot.RenderingServer.GetVideoAdapterVendor();
|
111 |
+
adapterName = adapterName.ToUpper(new System.Globalization.CultureInfo(""));
|
112 |
+
//TODO: GPU vendors for MacOS, what do they even use these days?
|
113 |
+
|
114 |
+
if (adapterName.Contains("INTEL"))
|
115 |
+
{
|
116 |
+
return ComputeName.DirectML;
|
117 |
+
}
|
118 |
+
if (adapterName.Contains("AMD") || adapterName.Contains("RADEON"))
|
119 |
+
{
|
120 |
+
return ComputeName.DirectML;
|
121 |
+
}
|
122 |
+
if (adapterName.Contains("NVIDIA"))
|
123 |
+
{
|
124 |
+
return ComputeName.CUDA;
|
125 |
+
}
|
126 |
+
|
127 |
+
GD.Print("Graphics Card not recognized."); //Should use CPU
|
128 |
+
return ComputeName.CPU;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
addons/godot_rl_agents/onnx/csharp/docs/ONNXInference.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<docs>
|
2 |
+
<members name="ONNXInference">
|
3 |
+
<ONNXInference>
|
4 |
+
<summary>
|
5 |
+
The main <c>ONNXInference</c> Class that handles the inference process.
|
6 |
+
</summary>
|
7 |
+
</ONNXInference>
|
8 |
+
<Initialize>
|
9 |
+
<summary>
|
10 |
+
Starts the inference process.
|
11 |
+
</summary>
|
12 |
+
<param name="Path">Path to the ONNX model, expects a path inside resources.</param>
|
13 |
+
<param name="BatchSize">How many observations will the model recieve.</param>
|
14 |
+
</Initialize>
|
15 |
+
<Run>
|
16 |
+
<summary>
|
17 |
+
Runs the given input through the model and returns the output.
|
18 |
+
</summary>
|
19 |
+
<param name="obs">Dictionary containing all observations.</param>
|
20 |
+
<param name="state_ins">How many different agents are creating these observations.</param>
|
21 |
+
<returns>A Dictionary of arrays, containing instructions based on the observations.</returns>
|
22 |
+
</Run>
|
23 |
+
<Load>
|
24 |
+
<summary>
|
25 |
+
Loads the given model into the inference process, using the best Execution provider available.
|
26 |
+
</summary>
|
27 |
+
<param name="Path">Path to the ONNX model, expects a path inside resources.</param>
|
28 |
+
<returns>InferenceSession ready to run.</returns>
|
29 |
+
</Load>
|
30 |
+
</members>
|
31 |
+
</docs>
|
addons/godot_rl_agents/onnx/csharp/docs/SessionConfigurator.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<docs>
|
2 |
+
<members name="SessionConfigurator">
|
3 |
+
<SessionConfigurator>
|
4 |
+
<summary>
|
5 |
+
The main <c>SessionConfigurator</c> Class that handles the execution options and providers for the inference process.
|
6 |
+
</summary>
|
7 |
+
</SessionConfigurator>
|
8 |
+
<GetSessionOptions>
|
9 |
+
<summary>
|
10 |
+
Creates a SessionOptions with all available execution providers.
|
11 |
+
</summary>
|
12 |
+
<returns>SessionOptions with all available execution providers.</returns>
|
13 |
+
</GetSessionOptions>
|
14 |
+
<SystemCheck>
|
15 |
+
<summary>
|
16 |
+
Appends any execution provider available in the current system.
|
17 |
+
</summary>
|
18 |
+
<remarks>
|
19 |
+
This function is mainly verbose for tracking implementation progress of different compute APIs.
|
20 |
+
</remarks>
|
21 |
+
</SystemCheck>
|
22 |
+
<ComputeCheck>
|
23 |
+
<summary>
|
24 |
+
Checks for available GPUs.
|
25 |
+
</summary>
|
26 |
+
<returns>An integer identifier for each compute platform.</returns>
|
27 |
+
</ComputeCheck>
|
28 |
+
</members>
|
29 |
+
</docs>
|
addons/godot_rl_agents/onnx/wrapper/ONNX_wrapper.gd
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Resource
|
2 |
+
class_name ONNXModel
|
3 |
+
var inferencer_script = load("res://addons/godot_rl_agents/onnx/csharp/ONNXInference.cs")
|
4 |
+
|
5 |
+
var inferencer = null
|
6 |
+
|
7 |
+
|
8 |
+
# Must provide the path to the model and the batch size
|
9 |
+
func _init(model_path, batch_size):
|
10 |
+
inferencer = inferencer_script.new()
|
11 |
+
inferencer.Initialize(model_path, batch_size)
|
12 |
+
|
13 |
+
|
14 |
+
# This function is the one that will be called from the game,
|
15 |
+
# requires the observation as an array and the state_ins as an int
|
16 |
+
# returns an Array containing the action the model takes.
|
17 |
+
func run_inference(obs: Array, state_ins: int) -> Dictionary:
|
18 |
+
if inferencer == null:
|
19 |
+
printerr("Inferencer not initialized")
|
20 |
+
return {}
|
21 |
+
return inferencer.RunInference(obs, state_ins)
|
22 |
+
|
23 |
+
|
24 |
+
func _notification(what):
|
25 |
+
if what == NOTIFICATION_PREDELETE:
|
26 |
+
inferencer.FreeDisposables()
|
27 |
+
inferencer.free()
|
addons/godot_rl_agents/plugin.cfg
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[plugin]
|
2 |
+
|
3 |
+
name="GodotRLAgents"
|
4 |
+
description="Custom nodes for the godot rl agents toolkit "
|
5 |
+
author="Edward Beeching"
|
6 |
+
version="0.1"
|
7 |
+
script="godot_rl_agents.gd"
|
addons/godot_rl_agents/sensors/sensors_2d/ExampleRaycastSensor2D.tscn
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[gd_scene load_steps=5 format=3 uid="uid://ddeq7mn1ealyc"]
|
2 |
+
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd" id="1"]
|
4 |
+
|
5 |
+
[sub_resource type="GDScript" id="2"]
|
6 |
+
script/source = "extends Node2D
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
func _physics_process(delta: float) -> void:
|
11 |
+
print(\"step start\")
|
12 |
+
|
13 |
+
"
|
14 |
+
|
15 |
+
[sub_resource type="GDScript" id="1"]
|
16 |
+
script/source = "extends RayCast2D
|
17 |
+
|
18 |
+
var steps = 1
|
19 |
+
|
20 |
+
func _physics_process(delta: float) -> void:
|
21 |
+
print(\"processing raycast\")
|
22 |
+
steps += 1
|
23 |
+
if steps % 2:
|
24 |
+
force_raycast_update()
|
25 |
+
|
26 |
+
print(is_colliding())
|
27 |
+
"
|
28 |
+
|
29 |
+
[sub_resource type="CircleShape2D" id="3"]
|
30 |
+
|
31 |
+
[node name="ExampleRaycastSensor2D" type="Node2D"]
|
32 |
+
script = SubResource("2")
|
33 |
+
|
34 |
+
[node name="ExampleAgent" type="Node2D" parent="."]
|
35 |
+
position = Vector2(573, 314)
|
36 |
+
rotation = 0.286234
|
37 |
+
|
38 |
+
[node name="RaycastSensor2D" type="Node2D" parent="ExampleAgent"]
|
39 |
+
script = ExtResource("1")
|
40 |
+
|
41 |
+
[node name="TestRayCast2D" type="RayCast2D" parent="."]
|
42 |
+
script = SubResource("1")
|
43 |
+
|
44 |
+
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
45 |
+
position = Vector2(1, 52)
|
46 |
+
|
47 |
+
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
48 |
+
shape = SubResource("3")
|
addons/godot_rl_agents/sensors/sensors_2d/GridSensor2D.gd
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@tool
|
2 |
+
extends ISensor2D
|
3 |
+
class_name GridSensor2D
|
4 |
+
|
5 |
+
@export var debug_view := false:
|
6 |
+
get:
|
7 |
+
return debug_view
|
8 |
+
set(value):
|
9 |
+
debug_view = value
|
10 |
+
_update()
|
11 |
+
|
12 |
+
@export_flags_2d_physics var detection_mask := 0:
|
13 |
+
get:
|
14 |
+
return detection_mask
|
15 |
+
set(value):
|
16 |
+
detection_mask = value
|
17 |
+
_update()
|
18 |
+
|
19 |
+
@export var collide_with_areas := false:
|
20 |
+
get:
|
21 |
+
return collide_with_areas
|
22 |
+
set(value):
|
23 |
+
collide_with_areas = value
|
24 |
+
_update()
|
25 |
+
|
26 |
+
@export var collide_with_bodies := true:
|
27 |
+
get:
|
28 |
+
return collide_with_bodies
|
29 |
+
set(value):
|
30 |
+
collide_with_bodies = value
|
31 |
+
_update()
|
32 |
+
|
33 |
+
@export_range(1, 200, 0.1) var cell_width := 20.0:
|
34 |
+
get:
|
35 |
+
return cell_width
|
36 |
+
set(value):
|
37 |
+
cell_width = value
|
38 |
+
_update()
|
39 |
+
|
40 |
+
@export_range(1, 200, 0.1) var cell_height := 20.0:
|
41 |
+
get:
|
42 |
+
return cell_height
|
43 |
+
set(value):
|
44 |
+
cell_height = value
|
45 |
+
_update()
|
46 |
+
|
47 |
+
@export_range(1, 21, 2, "or_greater") var grid_size_x := 3:
|
48 |
+
get:
|
49 |
+
return grid_size_x
|
50 |
+
set(value):
|
51 |
+
grid_size_x = value
|
52 |
+
_update()
|
53 |
+
|
54 |
+
@export_range(1, 21, 2, "or_greater") var grid_size_y := 3:
|
55 |
+
get:
|
56 |
+
return grid_size_y
|
57 |
+
set(value):
|
58 |
+
grid_size_y = value
|
59 |
+
_update()
|
60 |
+
|
61 |
+
var _obs_buffer: PackedFloat64Array
|
62 |
+
var _rectangle_shape: RectangleShape2D
|
63 |
+
var _collision_mapping: Dictionary
|
64 |
+
var _n_layers_per_cell: int
|
65 |
+
|
66 |
+
var _highlighted_cell_color: Color
|
67 |
+
var _standard_cell_color: Color
|
68 |
+
|
69 |
+
|
70 |
+
func get_observation():
|
71 |
+
return _obs_buffer
|
72 |
+
|
73 |
+
|
74 |
+
func _update():
|
75 |
+
if Engine.is_editor_hint():
|
76 |
+
if is_node_ready():
|
77 |
+
_spawn_nodes()
|
78 |
+
|
79 |
+
|
80 |
+
func _ready() -> void:
|
81 |
+
_set_colors()
|
82 |
+
|
83 |
+
if Engine.is_editor_hint():
|
84 |
+
if get_child_count() == 0:
|
85 |
+
_spawn_nodes()
|
86 |
+
else:
|
87 |
+
_spawn_nodes()
|
88 |
+
|
89 |
+
|
90 |
+
func _set_colors() -> void:
|
91 |
+
_standard_cell_color = Color(100.0 / 255.0, 100.0 / 255.0, 100.0 / 255.0, 100.0 / 255.0)
|
92 |
+
_highlighted_cell_color = Color(255.0 / 255.0, 100.0 / 255.0, 100.0 / 255.0, 100.0 / 255.0)
|
93 |
+
|
94 |
+
|
95 |
+
func _get_collision_mapping() -> Dictionary:
|
96 |
+
# defines which layer is mapped to which cell obs index
|
97 |
+
var total_bits = 0
|
98 |
+
var collision_mapping = {}
|
99 |
+
for i in 32:
|
100 |
+
var bit_mask = 2 ** i
|
101 |
+
if (detection_mask & bit_mask) > 0:
|
102 |
+
collision_mapping[i] = total_bits
|
103 |
+
total_bits += 1
|
104 |
+
|
105 |
+
return collision_mapping
|
106 |
+
|
107 |
+
|
108 |
+
func _spawn_nodes():
|
109 |
+
for cell in get_children():
|
110 |
+
cell.name = "_%s" % cell.name # Otherwise naming below will fail
|
111 |
+
cell.queue_free()
|
112 |
+
|
113 |
+
_collision_mapping = _get_collision_mapping()
|
114 |
+
#prints("collision_mapping", _collision_mapping, len(_collision_mapping))
|
115 |
+
# allocate memory for the observations
|
116 |
+
_n_layers_per_cell = len(_collision_mapping)
|
117 |
+
_obs_buffer = PackedFloat64Array()
|
118 |
+
_obs_buffer.resize(grid_size_x * grid_size_y * _n_layers_per_cell)
|
119 |
+
_obs_buffer.fill(0)
|
120 |
+
#prints(len(_obs_buffer), _obs_buffer )
|
121 |
+
|
122 |
+
_rectangle_shape = RectangleShape2D.new()
|
123 |
+
_rectangle_shape.set_size(Vector2(cell_width, cell_height))
|
124 |
+
|
125 |
+
var shift := Vector2(
|
126 |
+
-(grid_size_x / 2) * cell_width,
|
127 |
+
-(grid_size_y / 2) * cell_height,
|
128 |
+
)
|
129 |
+
|
130 |
+
for i in grid_size_x:
|
131 |
+
for j in grid_size_y:
|
132 |
+
var cell_position = Vector2(i * cell_width, j * cell_height) + shift
|
133 |
+
_create_cell(i, j, cell_position)
|
134 |
+
|
135 |
+
|
136 |
+
func _create_cell(i: int, j: int, position: Vector2):
|
137 |
+
var cell := Area2D.new()
|
138 |
+
cell.position = position
|
139 |
+
cell.name = "GridCell %s %s" % [i, j]
|
140 |
+
cell.modulate = _standard_cell_color
|
141 |
+
|
142 |
+
if collide_with_areas:
|
143 |
+
cell.area_entered.connect(_on_cell_area_entered.bind(i, j))
|
144 |
+
cell.area_exited.connect(_on_cell_area_exited.bind(i, j))
|
145 |
+
|
146 |
+
if collide_with_bodies:
|
147 |
+
cell.body_entered.connect(_on_cell_body_entered.bind(i, j))
|
148 |
+
cell.body_exited.connect(_on_cell_body_exited.bind(i, j))
|
149 |
+
|
150 |
+
cell.collision_layer = 0
|
151 |
+
cell.collision_mask = detection_mask
|
152 |
+
cell.monitorable = true
|
153 |
+
add_child(cell)
|
154 |
+
cell.set_owner(get_tree().edited_scene_root)
|
155 |
+
|
156 |
+
var col_shape := CollisionShape2D.new()
|
157 |
+
col_shape.shape = _rectangle_shape
|
158 |
+
col_shape.name = "CollisionShape2D"
|
159 |
+
cell.add_child(col_shape)
|
160 |
+
col_shape.set_owner(get_tree().edited_scene_root)
|
161 |
+
|
162 |
+
if debug_view:
|
163 |
+
var quad = MeshInstance2D.new()
|
164 |
+
quad.name = "MeshInstance2D"
|
165 |
+
var quad_mesh = QuadMesh.new()
|
166 |
+
|
167 |
+
quad_mesh.set_size(Vector2(cell_width, cell_height))
|
168 |
+
|
169 |
+
quad.mesh = quad_mesh
|
170 |
+
cell.add_child(quad)
|
171 |
+
quad.set_owner(get_tree().edited_scene_root)
|
172 |
+
|
173 |
+
|
174 |
+
func _update_obs(cell_i: int, cell_j: int, collision_layer: int, entered: bool):
|
175 |
+
for key in _collision_mapping:
|
176 |
+
var bit_mask = 2 ** key
|
177 |
+
if (collision_layer & bit_mask) > 0:
|
178 |
+
var collison_map_index = _collision_mapping[key]
|
179 |
+
|
180 |
+
var obs_index = (
|
181 |
+
(cell_i * grid_size_x * _n_layers_per_cell)
|
182 |
+
+ (cell_j * _n_layers_per_cell)
|
183 |
+
+ collison_map_index
|
184 |
+
)
|
185 |
+
#prints(obs_index, cell_i, cell_j)
|
186 |
+
if entered:
|
187 |
+
_obs_buffer[obs_index] += 1
|
188 |
+
else:
|
189 |
+
_obs_buffer[obs_index] -= 1
|
190 |
+
|
191 |
+
|
192 |
+
func _toggle_cell(cell_i: int, cell_j: int):
|
193 |
+
var cell = get_node_or_null("GridCell %s %s" % [cell_i, cell_j])
|
194 |
+
|
195 |
+
if cell == null:
|
196 |
+
print("cell not found, returning")
|
197 |
+
|
198 |
+
var n_hits = 0
|
199 |
+
var start_index = (cell_i * grid_size_x * _n_layers_per_cell) + (cell_j * _n_layers_per_cell)
|
200 |
+
for i in _n_layers_per_cell:
|
201 |
+
n_hits += _obs_buffer[start_index + i]
|
202 |
+
|
203 |
+
if n_hits > 0:
|
204 |
+
cell.modulate = _highlighted_cell_color
|
205 |
+
else:
|
206 |
+
cell.modulate = _standard_cell_color
|
207 |
+
|
208 |
+
|
209 |
+
func _on_cell_area_entered(area: Area2D, cell_i: int, cell_j: int):
|
210 |
+
#prints("_on_cell_area_entered", cell_i, cell_j)
|
211 |
+
_update_obs(cell_i, cell_j, area.collision_layer, true)
|
212 |
+
if debug_view:
|
213 |
+
_toggle_cell(cell_i, cell_j)
|
214 |
+
#print(_obs_buffer)
|
215 |
+
|
216 |
+
|
217 |
+
func _on_cell_area_exited(area: Area2D, cell_i: int, cell_j: int):
|
218 |
+
#prints("_on_cell_area_exited", cell_i, cell_j)
|
219 |
+
_update_obs(cell_i, cell_j, area.collision_layer, false)
|
220 |
+
if debug_view:
|
221 |
+
_toggle_cell(cell_i, cell_j)
|
222 |
+
|
223 |
+
|
224 |
+
func _on_cell_body_entered(body: Node2D, cell_i: int, cell_j: int):
|
225 |
+
#prints("_on_cell_body_entered", cell_i, cell_j)
|
226 |
+
_update_obs(cell_i, cell_j, body.collision_layer, true)
|
227 |
+
if debug_view:
|
228 |
+
_toggle_cell(cell_i, cell_j)
|
229 |
+
|
230 |
+
|
231 |
+
func _on_cell_body_exited(body: Node2D, cell_i: int, cell_j: int):
|
232 |
+
#prints("_on_cell_body_exited", cell_i, cell_j)
|
233 |
+
_update_obs(cell_i, cell_j, body.collision_layer, false)
|
234 |
+
if debug_view:
|
235 |
+
_toggle_cell(cell_i, cell_j)
|
addons/godot_rl_agents/sensors/sensors_2d/ISensor2D.gd
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node2D
|
2 |
+
class_name ISensor2D
|
3 |
+
|
4 |
+
var _obs: Array = []
|
5 |
+
var _active := false
|
6 |
+
|
7 |
+
|
8 |
+
func get_observation():
|
9 |
+
pass
|
10 |
+
|
11 |
+
|
12 |
+
func activate():
|
13 |
+
_active = true
|
14 |
+
|
15 |
+
|
16 |
+
func deactivate():
|
17 |
+
_active = false
|
18 |
+
|
19 |
+
|
20 |
+
func _update_observation():
|
21 |
+
pass
|
22 |
+
|
23 |
+
|
24 |
+
func reset():
|
25 |
+
pass
|
addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@tool
|
2 |
+
extends ISensor2D
|
3 |
+
class_name RaycastSensor2D
|
4 |
+
|
5 |
+
@export_flags_2d_physics var collision_mask := 1:
|
6 |
+
get:
|
7 |
+
return collision_mask
|
8 |
+
set(value):
|
9 |
+
collision_mask = value
|
10 |
+
_update()
|
11 |
+
|
12 |
+
@export var collide_with_areas := false:
|
13 |
+
get:
|
14 |
+
return collide_with_areas
|
15 |
+
set(value):
|
16 |
+
collide_with_areas = value
|
17 |
+
_update()
|
18 |
+
|
19 |
+
@export var collide_with_bodies := true:
|
20 |
+
get:
|
21 |
+
return collide_with_bodies
|
22 |
+
set(value):
|
23 |
+
collide_with_bodies = value
|
24 |
+
_update()
|
25 |
+
|
26 |
+
@export var n_rays := 16.0:
|
27 |
+
get:
|
28 |
+
return n_rays
|
29 |
+
set(value):
|
30 |
+
n_rays = value
|
31 |
+
_update()
|
32 |
+
|
33 |
+
@export_range(5, 3000, 5.0) var ray_length := 200:
|
34 |
+
get:
|
35 |
+
return ray_length
|
36 |
+
set(value):
|
37 |
+
ray_length = value
|
38 |
+
_update()
|
39 |
+
@export_range(5, 360, 5.0) var cone_width := 360.0:
|
40 |
+
get:
|
41 |
+
return cone_width
|
42 |
+
set(value):
|
43 |
+
cone_width = value
|
44 |
+
_update()
|
45 |
+
|
46 |
+
@export var debug_draw := true:
|
47 |
+
get:
|
48 |
+
return debug_draw
|
49 |
+
set(value):
|
50 |
+
debug_draw = value
|
51 |
+
_update()
|
52 |
+
|
53 |
+
var _angles = []
|
54 |
+
var rays := []
|
55 |
+
|
56 |
+
|
57 |
+
func _update():
|
58 |
+
if Engine.is_editor_hint():
|
59 |
+
if debug_draw:
|
60 |
+
_spawn_nodes()
|
61 |
+
else:
|
62 |
+
for ray in get_children():
|
63 |
+
if ray is RayCast2D:
|
64 |
+
remove_child(ray)
|
65 |
+
|
66 |
+
|
67 |
+
func _ready() -> void:
|
68 |
+
_spawn_nodes()
|
69 |
+
|
70 |
+
|
71 |
+
func _spawn_nodes():
|
72 |
+
for ray in rays:
|
73 |
+
ray.queue_free()
|
74 |
+
rays = []
|
75 |
+
|
76 |
+
_angles = []
|
77 |
+
var step = cone_width / (n_rays)
|
78 |
+
var start = step / 2 - cone_width / 2
|
79 |
+
|
80 |
+
for i in n_rays:
|
81 |
+
var angle = start + i * step
|
82 |
+
var ray = RayCast2D.new()
|
83 |
+
ray.set_target_position(
|
84 |
+
Vector2(ray_length * cos(deg_to_rad(angle)), ray_length * sin(deg_to_rad(angle)))
|
85 |
+
)
|
86 |
+
ray.set_name("node_" + str(i))
|
87 |
+
ray.enabled = false
|
88 |
+
ray.collide_with_areas = collide_with_areas
|
89 |
+
ray.collide_with_bodies = collide_with_bodies
|
90 |
+
ray.collision_mask = collision_mask
|
91 |
+
add_child(ray)
|
92 |
+
rays.append(ray)
|
93 |
+
|
94 |
+
_angles.append(start + i * step)
|
95 |
+
|
96 |
+
|
97 |
+
func get_observation() -> Array:
|
98 |
+
return self.calculate_raycasts()
|
99 |
+
|
100 |
+
|
101 |
+
func calculate_raycasts() -> Array:
|
102 |
+
var result = []
|
103 |
+
for ray in rays:
|
104 |
+
ray.enabled = true
|
105 |
+
ray.force_raycast_update()
|
106 |
+
var distance = _get_raycast_distance(ray)
|
107 |
+
result.append(distance)
|
108 |
+
ray.enabled = false
|
109 |
+
return result
|
110 |
+
|
111 |
+
|
112 |
+
func _get_raycast_distance(ray: RayCast2D) -> float:
|
113 |
+
if !ray.is_colliding():
|
114 |
+
return 0.0
|
115 |
+
|
116 |
+
var distance = (global_position - ray.get_collision_point()).length()
|
117 |
+
distance = clamp(distance, 0.0, ray_length)
|
118 |
+
return (ray_length - distance) / ray_length
|
addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.tscn
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[gd_scene load_steps=2 format=3 uid="uid://drvfihk5esgmv"]
|
2 |
+
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd" id="1"]
|
4 |
+
|
5 |
+
[node name="RaycastSensor2D" type="Node2D"]
|
6 |
+
script = ExtResource("1")
|
7 |
+
n_rays = 17.0
|
addons/godot_rl_agents/sensors/sensors_3d/ExampleRaycastSensor3D.tscn
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[gd_scene format=3 uid="uid://biu787qh4woik"]
|
2 |
+
|
3 |
+
[node name="ExampleRaycastSensor3D" type="Node3D"]
|
4 |
+
|
5 |
+
[node name="Camera3D" type="Camera3D" parent="."]
|
6 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.804183, 0, 2.70146)
|
addons/godot_rl_agents/sensors/sensors_3d/GridSensor3D.gd
ADDED
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@tool
|
2 |
+
extends ISensor3D
|
3 |
+
class_name GridSensor3D
|
4 |
+
|
5 |
+
@export var debug_view := false:
|
6 |
+
get:
|
7 |
+
return debug_view
|
8 |
+
set(value):
|
9 |
+
debug_view = value
|
10 |
+
_update()
|
11 |
+
|
12 |
+
@export_flags_3d_physics var detection_mask := 0:
|
13 |
+
get:
|
14 |
+
return detection_mask
|
15 |
+
set(value):
|
16 |
+
detection_mask = value
|
17 |
+
_update()
|
18 |
+
|
19 |
+
@export var collide_with_areas := false:
|
20 |
+
get:
|
21 |
+
return collide_with_areas
|
22 |
+
set(value):
|
23 |
+
collide_with_areas = value
|
24 |
+
_update()
|
25 |
+
|
26 |
+
@export var collide_with_bodies := false:
|
27 |
+
# NOTE! The sensor will not detect StaticBody3D, add an area to static bodies to detect them
|
28 |
+
get:
|
29 |
+
return collide_with_bodies
|
30 |
+
set(value):
|
31 |
+
collide_with_bodies = value
|
32 |
+
_update()
|
33 |
+
|
34 |
+
@export_range(0.1, 2, 0.1) var cell_width := 1.0:
|
35 |
+
get:
|
36 |
+
return cell_width
|
37 |
+
set(value):
|
38 |
+
cell_width = value
|
39 |
+
_update()
|
40 |
+
|
41 |
+
@export_range(0.1, 2, 0.1) var cell_height := 1.0:
|
42 |
+
get:
|
43 |
+
return cell_height
|
44 |
+
set(value):
|
45 |
+
cell_height = value
|
46 |
+
_update()
|
47 |
+
|
48 |
+
@export_range(1, 21, 2, "or_greater") var grid_size_x := 3:
|
49 |
+
get:
|
50 |
+
return grid_size_x
|
51 |
+
set(value):
|
52 |
+
grid_size_x = value
|
53 |
+
_update()
|
54 |
+
|
55 |
+
@export_range(1, 21, 2, "or_greater") var grid_size_z := 3:
|
56 |
+
get:
|
57 |
+
return grid_size_z
|
58 |
+
set(value):
|
59 |
+
grid_size_z = value
|
60 |
+
_update()
|
61 |
+
|
62 |
+
var _obs_buffer: PackedFloat64Array
|
63 |
+
var _box_shape: BoxShape3D
|
64 |
+
var _collision_mapping: Dictionary
|
65 |
+
var _n_layers_per_cell: int
|
66 |
+
|
67 |
+
var _highlighted_box_material: StandardMaterial3D
|
68 |
+
var _standard_box_material: StandardMaterial3D
|
69 |
+
|
70 |
+
|
71 |
+
func get_observation():
|
72 |
+
return _obs_buffer
|
73 |
+
|
74 |
+
|
75 |
+
func reset():
|
76 |
+
_obs_buffer.fill(0)
|
77 |
+
|
78 |
+
|
79 |
+
func _update():
|
80 |
+
if Engine.is_editor_hint():
|
81 |
+
if is_node_ready():
|
82 |
+
_spawn_nodes()
|
83 |
+
|
84 |
+
|
85 |
+
func _ready() -> void:
|
86 |
+
_make_materials()
|
87 |
+
|
88 |
+
if Engine.is_editor_hint():
|
89 |
+
if get_child_count() == 0:
|
90 |
+
_spawn_nodes()
|
91 |
+
else:
|
92 |
+
_spawn_nodes()
|
93 |
+
|
94 |
+
|
95 |
+
func _make_materials() -> void:
|
96 |
+
if _highlighted_box_material != null and _standard_box_material != null:
|
97 |
+
return
|
98 |
+
|
99 |
+
_standard_box_material = StandardMaterial3D.new()
|
100 |
+
_standard_box_material.set_transparency(1) # ALPHA
|
101 |
+
_standard_box_material.albedo_color = Color(
|
102 |
+
100.0 / 255.0, 100.0 / 255.0, 100.0 / 255.0, 100.0 / 255.0
|
103 |
+
)
|
104 |
+
|
105 |
+
_highlighted_box_material = StandardMaterial3D.new()
|
106 |
+
_highlighted_box_material.set_transparency(1) # ALPHA
|
107 |
+
_highlighted_box_material.albedo_color = Color(
|
108 |
+
255.0 / 255.0, 100.0 / 255.0, 100.0 / 255.0, 100.0 / 255.0
|
109 |
+
)
|
110 |
+
|
111 |
+
|
112 |
+
func _get_collision_mapping() -> Dictionary:
|
113 |
+
# defines which layer is mapped to which cell obs index
|
114 |
+
var total_bits = 0
|
115 |
+
var collision_mapping = {}
|
116 |
+
for i in 32:
|
117 |
+
var bit_mask = 2 ** i
|
118 |
+
if (detection_mask & bit_mask) > 0:
|
119 |
+
collision_mapping[i] = total_bits
|
120 |
+
total_bits += 1
|
121 |
+
|
122 |
+
return collision_mapping
|
123 |
+
|
124 |
+
|
125 |
+
func _spawn_nodes():
|
126 |
+
for cell in get_children():
|
127 |
+
cell.name = "_%s" % cell.name # Otherwise naming below will fail
|
128 |
+
cell.queue_free()
|
129 |
+
|
130 |
+
_collision_mapping = _get_collision_mapping()
|
131 |
+
#prints("collision_mapping", _collision_mapping, len(_collision_mapping))
|
132 |
+
# allocate memory for the observations
|
133 |
+
_n_layers_per_cell = len(_collision_mapping)
|
134 |
+
_obs_buffer = PackedFloat64Array()
|
135 |
+
_obs_buffer.resize(grid_size_x * grid_size_z * _n_layers_per_cell)
|
136 |
+
_obs_buffer.fill(0)
|
137 |
+
#prints(len(_obs_buffer), _obs_buffer )
|
138 |
+
|
139 |
+
_box_shape = BoxShape3D.new()
|
140 |
+
_box_shape.set_size(Vector3(cell_width, cell_height, cell_width))
|
141 |
+
|
142 |
+
var shift := Vector3(
|
143 |
+
-(grid_size_x / 2) * cell_width,
|
144 |
+
0,
|
145 |
+
-(grid_size_z / 2) * cell_width,
|
146 |
+
)
|
147 |
+
|
148 |
+
for i in grid_size_x:
|
149 |
+
for j in grid_size_z:
|
150 |
+
var cell_position = Vector3(i * cell_width, 0.0, j * cell_width) + shift
|
151 |
+
_create_cell(i, j, cell_position)
|
152 |
+
|
153 |
+
|
154 |
+
func _create_cell(i: int, j: int, position: Vector3):
|
155 |
+
var cell := Area3D.new()
|
156 |
+
cell.position = position
|
157 |
+
cell.name = "GridCell %s %s" % [i, j]
|
158 |
+
|
159 |
+
if collide_with_areas:
|
160 |
+
cell.area_entered.connect(_on_cell_area_entered.bind(i, j))
|
161 |
+
cell.area_exited.connect(_on_cell_area_exited.bind(i, j))
|
162 |
+
|
163 |
+
if collide_with_bodies:
|
164 |
+
cell.body_entered.connect(_on_cell_body_entered.bind(i, j))
|
165 |
+
cell.body_exited.connect(_on_cell_body_exited.bind(i, j))
|
166 |
+
|
167 |
+
# cell.body_shape_entered.connect(_on_cell_body_shape_entered.bind(i, j))
|
168 |
+
# cell.body_shape_exited.connect(_on_cell_body_shape_exited.bind(i, j))
|
169 |
+
|
170 |
+
cell.collision_layer = 0
|
171 |
+
cell.collision_mask = detection_mask
|
172 |
+
cell.monitorable = true
|
173 |
+
cell.input_ray_pickable = false
|
174 |
+
add_child(cell)
|
175 |
+
cell.set_owner(get_tree().edited_scene_root)
|
176 |
+
|
177 |
+
var col_shape := CollisionShape3D.new()
|
178 |
+
col_shape.shape = _box_shape
|
179 |
+
col_shape.name = "CollisionShape3D"
|
180 |
+
cell.add_child(col_shape)
|
181 |
+
col_shape.set_owner(get_tree().edited_scene_root)
|
182 |
+
|
183 |
+
if debug_view:
|
184 |
+
var box = MeshInstance3D.new()
|
185 |
+
box.name = "MeshInstance3D"
|
186 |
+
var box_mesh = BoxMesh.new()
|
187 |
+
|
188 |
+
box_mesh.set_size(Vector3(cell_width, cell_height, cell_width))
|
189 |
+
box_mesh.material = _standard_box_material
|
190 |
+
|
191 |
+
box.mesh = box_mesh
|
192 |
+
cell.add_child(box)
|
193 |
+
box.set_owner(get_tree().edited_scene_root)
|
194 |
+
|
195 |
+
|
196 |
+
func _update_obs(cell_i: int, cell_j: int, collision_layer: int, entered: bool):
|
197 |
+
for key in _collision_mapping:
|
198 |
+
var bit_mask = 2 ** key
|
199 |
+
if (collision_layer & bit_mask) > 0:
|
200 |
+
var collison_map_index = _collision_mapping[key]
|
201 |
+
|
202 |
+
var obs_index = (
|
203 |
+
(cell_i * grid_size_x * _n_layers_per_cell)
|
204 |
+
+ (cell_j * _n_layers_per_cell)
|
205 |
+
+ collison_map_index
|
206 |
+
)
|
207 |
+
#prints(obs_index, cell_i, cell_j)
|
208 |
+
if entered:
|
209 |
+
_obs_buffer[obs_index] += 1
|
210 |
+
else:
|
211 |
+
_obs_buffer[obs_index] -= 1
|
212 |
+
|
213 |
+
|
214 |
+
func _toggle_cell(cell_i: int, cell_j: int):
|
215 |
+
var cell = get_node_or_null("GridCell %s %s" % [cell_i, cell_j])
|
216 |
+
|
217 |
+
if cell == null:
|
218 |
+
print("cell not found, returning")
|
219 |
+
|
220 |
+
var n_hits = 0
|
221 |
+
var start_index = (cell_i * grid_size_x * _n_layers_per_cell) + (cell_j * _n_layers_per_cell)
|
222 |
+
for i in _n_layers_per_cell:
|
223 |
+
n_hits += _obs_buffer[start_index + i]
|
224 |
+
|
225 |
+
var cell_mesh = cell.get_node_or_null("MeshInstance3D")
|
226 |
+
if n_hits > 0:
|
227 |
+
cell_mesh.mesh.material = _highlighted_box_material
|
228 |
+
else:
|
229 |
+
cell_mesh.mesh.material = _standard_box_material
|
230 |
+
|
231 |
+
|
232 |
+
func _on_cell_area_entered(area: Area3D, cell_i: int, cell_j: int):
|
233 |
+
#prints("_on_cell_area_entered", cell_i, cell_j)
|
234 |
+
_update_obs(cell_i, cell_j, area.collision_layer, true)
|
235 |
+
if debug_view:
|
236 |
+
_toggle_cell(cell_i, cell_j)
|
237 |
+
#print(_obs_buffer)
|
238 |
+
|
239 |
+
|
240 |
+
func _on_cell_area_exited(area: Area3D, cell_i: int, cell_j: int):
|
241 |
+
#prints("_on_cell_area_exited", cell_i, cell_j)
|
242 |
+
_update_obs(cell_i, cell_j, area.collision_layer, false)
|
243 |
+
if debug_view:
|
244 |
+
_toggle_cell(cell_i, cell_j)
|
245 |
+
|
246 |
+
|
247 |
+
func _on_cell_body_entered(body: Node3D, cell_i: int, cell_j: int):
|
248 |
+
#prints("_on_cell_body_entered", cell_i, cell_j)
|
249 |
+
_update_obs(cell_i, cell_j, body.collision_layer, true)
|
250 |
+
if debug_view:
|
251 |
+
_toggle_cell(cell_i, cell_j)
|
252 |
+
|
253 |
+
|
254 |
+
func _on_cell_body_exited(body: Node3D, cell_i: int, cell_j: int):
|
255 |
+
#prints("_on_cell_body_exited", cell_i, cell_j)
|
256 |
+
_update_obs(cell_i, cell_j, body.collision_layer, false)
|
257 |
+
if debug_view:
|
258 |
+
_toggle_cell(cell_i, cell_j)
|
addons/godot_rl_agents/sensors/sensors_3d/ISensor3D.gd
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node3D
|
2 |
+
class_name ISensor3D
|
3 |
+
|
4 |
+
var _obs: Array = []
|
5 |
+
var _active := false
|
6 |
+
|
7 |
+
|
8 |
+
func get_observation():
|
9 |
+
pass
|
10 |
+
|
11 |
+
|
12 |
+
func activate():
|
13 |
+
_active = true
|
14 |
+
|
15 |
+
|
16 |
+
func deactivate():
|
17 |
+
_active = false
|
18 |
+
|
19 |
+
|
20 |
+
func _update_observation():
|
21 |
+
pass
|
22 |
+
|
23 |
+
|
24 |
+
func reset():
|
25 |
+
pass
|
addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.gd
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node3D
|
2 |
+
class_name RGBCameraSensor3D
|
3 |
+
var camera_pixels = null
|
4 |
+
|
5 |
+
@onready var camera_texture := $Control/TextureRect/CameraTexture as Sprite2D
|
6 |
+
@onready var sub_viewport := $SubViewport as SubViewport
|
7 |
+
|
8 |
+
|
9 |
+
func get_camera_pixel_encoding():
|
10 |
+
return camera_texture.get_texture().get_image().get_data().hex_encode()
|
11 |
+
|
12 |
+
|
13 |
+
func get_camera_shape() -> Array:
|
14 |
+
assert(
|
15 |
+
sub_viewport.size.x >= 36 and sub_viewport.size.y >= 36,
|
16 |
+
"SubViewport size must be 36x36 or larger."
|
17 |
+
)
|
18 |
+
if sub_viewport.transparent_bg:
|
19 |
+
return [4, sub_viewport.size.y, sub_viewport.size.x]
|
20 |
+
else:
|
21 |
+
return [3, sub_viewport.size.y, sub_viewport.size.x]
|
addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.tscn
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[gd_scene load_steps=3 format=3 uid="uid://baaywi3arsl2m"]
|
2 |
+
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.gd" id="1"]
|
4 |
+
|
5 |
+
[sub_resource type="ViewportTexture" id="1"]
|
6 |
+
viewport_path = NodePath("SubViewport")
|
7 |
+
|
8 |
+
[node name="RGBCameraSensor3D" type="Node3D"]
|
9 |
+
script = ExtResource("1")
|
10 |
+
|
11 |
+
[node name="RemoteTransform3D" type="RemoteTransform3D" parent="."]
|
12 |
+
remote_path = NodePath("../SubViewport/Camera3D")
|
13 |
+
|
14 |
+
[node name="SubViewport" type="SubViewport" parent="."]
|
15 |
+
size = Vector2i(32, 32)
|
16 |
+
render_target_update_mode = 3
|
17 |
+
|
18 |
+
[node name="Camera3D" type="Camera3D" parent="SubViewport"]
|
19 |
+
near = 0.5
|
20 |
+
|
21 |
+
[node name="Control" type="Control" parent="."]
|
22 |
+
layout_mode = 3
|
23 |
+
anchors_preset = 15
|
24 |
+
anchor_right = 1.0
|
25 |
+
anchor_bottom = 1.0
|
26 |
+
grow_horizontal = 2
|
27 |
+
grow_vertical = 2
|
28 |
+
|
29 |
+
[node name="TextureRect" type="ColorRect" parent="Control"]
|
30 |
+
layout_mode = 0
|
31 |
+
offset_left = 1096.0
|
32 |
+
offset_top = 534.0
|
33 |
+
offset_right = 1114.0
|
34 |
+
offset_bottom = 552.0
|
35 |
+
scale = Vector2(10, 10)
|
36 |
+
color = Color(0.00784314, 0.00784314, 0.00784314, 1)
|
37 |
+
|
38 |
+
[node name="CameraTexture" type="Sprite2D" parent="Control/TextureRect"]
|
39 |
+
texture = SubResource("1")
|
40 |
+
offset = Vector2(9, 9)
|
41 |
+
flip_v = true
|
addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@tool
|
2 |
+
extends ISensor3D
|
3 |
+
class_name RayCastSensor3D
|
4 |
+
@export_flags_3d_physics var collision_mask = 1:
|
5 |
+
get:
|
6 |
+
return collision_mask
|
7 |
+
set(value):
|
8 |
+
collision_mask = value
|
9 |
+
_update()
|
10 |
+
@export_flags_3d_physics var boolean_class_mask = 1:
|
11 |
+
get:
|
12 |
+
return boolean_class_mask
|
13 |
+
set(value):
|
14 |
+
boolean_class_mask = value
|
15 |
+
_update()
|
16 |
+
|
17 |
+
@export var n_rays_width := 6.0:
|
18 |
+
get:
|
19 |
+
return n_rays_width
|
20 |
+
set(value):
|
21 |
+
n_rays_width = value
|
22 |
+
_update()
|
23 |
+
|
24 |
+
@export var n_rays_height := 6.0:
|
25 |
+
get:
|
26 |
+
return n_rays_height
|
27 |
+
set(value):
|
28 |
+
n_rays_height = value
|
29 |
+
_update()
|
30 |
+
|
31 |
+
@export var ray_length := 10.0:
|
32 |
+
get:
|
33 |
+
return ray_length
|
34 |
+
set(value):
|
35 |
+
ray_length = value
|
36 |
+
_update()
|
37 |
+
|
38 |
+
@export var cone_width := 60.0:
|
39 |
+
get:
|
40 |
+
return cone_width
|
41 |
+
set(value):
|
42 |
+
cone_width = value
|
43 |
+
_update()
|
44 |
+
|
45 |
+
@export var cone_height := 60.0:
|
46 |
+
get:
|
47 |
+
return cone_height
|
48 |
+
set(value):
|
49 |
+
cone_height = value
|
50 |
+
_update()
|
51 |
+
|
52 |
+
@export var collide_with_areas := false:
|
53 |
+
get:
|
54 |
+
return collide_with_areas
|
55 |
+
set(value):
|
56 |
+
collide_with_areas = value
|
57 |
+
_update()
|
58 |
+
|
59 |
+
@export var collide_with_bodies := true:
|
60 |
+
get:
|
61 |
+
return collide_with_bodies
|
62 |
+
set(value):
|
63 |
+
collide_with_bodies = value
|
64 |
+
_update()
|
65 |
+
|
66 |
+
@export var class_sensor := false
|
67 |
+
|
68 |
+
var rays := []
|
69 |
+
var geo = null
|
70 |
+
|
71 |
+
|
72 |
+
func _update():
|
73 |
+
if Engine.is_editor_hint():
|
74 |
+
if is_node_ready():
|
75 |
+
_spawn_nodes()
|
76 |
+
|
77 |
+
|
78 |
+
func _ready() -> void:
|
79 |
+
if Engine.is_editor_hint():
|
80 |
+
if get_child_count() == 0:
|
81 |
+
_spawn_nodes()
|
82 |
+
else:
|
83 |
+
_spawn_nodes()
|
84 |
+
|
85 |
+
|
86 |
+
func _spawn_nodes():
|
87 |
+
print("spawning nodes")
|
88 |
+
for ray in get_children():
|
89 |
+
ray.queue_free()
|
90 |
+
if geo:
|
91 |
+
geo.clear()
|
92 |
+
#$Lines.remove_points()
|
93 |
+
rays = []
|
94 |
+
|
95 |
+
var horizontal_step = cone_width / (n_rays_width)
|
96 |
+
var vertical_step = cone_height / (n_rays_height)
|
97 |
+
|
98 |
+
var horizontal_start = horizontal_step / 2 - cone_width / 2
|
99 |
+
var vertical_start = vertical_step / 2 - cone_height / 2
|
100 |
+
|
101 |
+
var points = []
|
102 |
+
|
103 |
+
for i in n_rays_width:
|
104 |
+
for j in n_rays_height:
|
105 |
+
var angle_w = horizontal_start + i * horizontal_step
|
106 |
+
var angle_h = vertical_start + j * vertical_step
|
107 |
+
#angle_h = 0.0
|
108 |
+
var ray = RayCast3D.new()
|
109 |
+
var cast_to = to_spherical_coords(ray_length, angle_w, angle_h)
|
110 |
+
ray.set_target_position(cast_to)
|
111 |
+
|
112 |
+
points.append(cast_to)
|
113 |
+
|
114 |
+
ray.set_name("node_" + str(i) + " " + str(j))
|
115 |
+
ray.enabled = true
|
116 |
+
ray.collide_with_bodies = collide_with_bodies
|
117 |
+
ray.collide_with_areas = collide_with_areas
|
118 |
+
ray.collision_mask = collision_mask
|
119 |
+
add_child(ray)
|
120 |
+
ray.set_owner(get_tree().edited_scene_root)
|
121 |
+
rays.append(ray)
|
122 |
+
ray.force_raycast_update()
|
123 |
+
|
124 |
+
|
125 |
+
# if Engine.editor_hint:
|
126 |
+
# _create_debug_lines(points)
|
127 |
+
|
128 |
+
|
129 |
+
func _create_debug_lines(points):
|
130 |
+
if not geo:
|
131 |
+
geo = ImmediateMesh.new()
|
132 |
+
add_child(geo)
|
133 |
+
|
134 |
+
geo.clear()
|
135 |
+
geo.begin(Mesh.PRIMITIVE_LINES)
|
136 |
+
for point in points:
|
137 |
+
geo.set_color(Color.AQUA)
|
138 |
+
geo.add_vertex(Vector3.ZERO)
|
139 |
+
geo.add_vertex(point)
|
140 |
+
geo.end()
|
141 |
+
|
142 |
+
|
143 |
+
func display():
|
144 |
+
if geo:
|
145 |
+
geo.display()
|
146 |
+
|
147 |
+
|
148 |
+
func to_spherical_coords(r, inc, azimuth) -> Vector3:
|
149 |
+
return Vector3(
|
150 |
+
r * sin(deg_to_rad(inc)) * cos(deg_to_rad(azimuth)),
|
151 |
+
r * sin(deg_to_rad(azimuth)),
|
152 |
+
r * cos(deg_to_rad(inc)) * cos(deg_to_rad(azimuth))
|
153 |
+
)
|
154 |
+
|
155 |
+
|
156 |
+
func get_observation() -> Array:
|
157 |
+
return self.calculate_raycasts()
|
158 |
+
|
159 |
+
|
160 |
+
func calculate_raycasts() -> Array:
|
161 |
+
var result = []
|
162 |
+
for ray in rays:
|
163 |
+
ray.set_enabled(true)
|
164 |
+
ray.force_raycast_update()
|
165 |
+
var distance = _get_raycast_distance(ray)
|
166 |
+
|
167 |
+
result.append(distance)
|
168 |
+
if class_sensor:
|
169 |
+
var hit_class: float = 0
|
170 |
+
if ray.get_collider():
|
171 |
+
var hit_collision_layer = ray.get_collider().collision_layer
|
172 |
+
hit_collision_layer = hit_collision_layer & collision_mask
|
173 |
+
hit_class = (hit_collision_layer & boolean_class_mask) > 0
|
174 |
+
result.append(float(hit_class))
|
175 |
+
ray.set_enabled(false)
|
176 |
+
return result
|
177 |
+
|
178 |
+
|
179 |
+
func _get_raycast_distance(ray: RayCast3D) -> float:
|
180 |
+
if !ray.is_colliding():
|
181 |
+
return 0.0
|
182 |
+
|
183 |
+
var distance = (global_transform.origin - ray.get_collision_point()).length()
|
184 |
+
distance = clamp(distance, 0.0, ray_length)
|
185 |
+
return (ray_length - distance) / ray_length
|
addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.tscn
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[gd_scene load_steps=2 format=3 uid="uid://b803cbh1fmy66"]
|
2 |
+
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd" id="1"]
|
4 |
+
|
5 |
+
[node name="RaycastSensor3D" type="Node3D"]
|
6 |
+
script = ExtResource("1")
|
7 |
+
n_rays_width = 4.0
|
8 |
+
n_rays_height = 2.0
|
9 |
+
ray_length = 11.0
|
10 |
+
|
11 |
+
[node name="node_1 0" type="RayCast3D" parent="."]
|
12 |
+
target_position = Vector3(-1.38686, -2.84701, 10.5343)
|
13 |
+
|
14 |
+
[node name="node_1 1" type="RayCast3D" parent="."]
|
15 |
+
target_position = Vector3(-1.38686, 2.84701, 10.5343)
|
16 |
+
|
17 |
+
[node name="node_2 0" type="RayCast3D" parent="."]
|
18 |
+
target_position = Vector3(1.38686, -2.84701, 10.5343)
|
19 |
+
|
20 |
+
[node name="node_2 1" type="RayCast3D" parent="."]
|
21 |
+
target_position = Vector3(1.38686, 2.84701, 10.5343)
|
22 |
+
|
23 |
+
[node name="node_3 0" type="RayCast3D" parent="."]
|
24 |
+
target_position = Vector3(4.06608, -2.84701, 9.81639)
|
25 |
+
|
26 |
+
[node name="node_3 1" type="RayCast3D" parent="."]
|
27 |
+
target_position = Vector3(4.06608, 2.84701, 9.81639)
|
addons/godot_rl_agents/sync.gd
ADDED
@@ -0,0 +1,540 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node
|
2 |
+
|
3 |
+
# --fixed-fps 2000 --disable-render-loop
|
4 |
+
|
5 |
+
enum ControlModes { HUMAN, TRAINING, ONNX_INFERENCE }
|
6 |
+
@export var control_mode: ControlModes = ControlModes.TRAINING
|
7 |
+
@export_range(1, 10, 1, "or_greater") var action_repeat := 8
|
8 |
+
@export_range(0, 10, 0.1, "or_greater") var speed_up := 1.0
|
9 |
+
@export var onnx_model_path := ""
|
10 |
+
|
11 |
+
# Onnx model stored for each requested path
|
12 |
+
var onnx_models: Dictionary
|
13 |
+
|
14 |
+
@onready var start_time = Time.get_ticks_msec()
|
15 |
+
|
16 |
+
const MAJOR_VERSION := "0"
|
17 |
+
const MINOR_VERSION := "7"
|
18 |
+
const DEFAULT_PORT := "11008"
|
19 |
+
const DEFAULT_SEED := "1"
|
20 |
+
var stream: StreamPeerTCP = null
|
21 |
+
var connected = false
|
22 |
+
var message_center
|
23 |
+
var should_connect = true
|
24 |
+
|
25 |
+
var all_agents: Array
|
26 |
+
var agents_training: Array
|
27 |
+
var agents_inference: Array
|
28 |
+
var agents_heuristic: Array
|
29 |
+
|
30 |
+
## For recording expert demos
|
31 |
+
var agent_demo_record: Node
|
32 |
+
## Stores recorded trajectories
|
33 |
+
var demo_trajectories: Array
|
34 |
+
## A trajectory includes obs: Array, acts: Array, terminal (set in Python env instead)
|
35 |
+
var current_demo_trajectory: Array
|
36 |
+
|
37 |
+
var need_to_send_obs = false
|
38 |
+
var args = null
|
39 |
+
var initialized = false
|
40 |
+
var just_reset = false
|
41 |
+
var onnx_model = null
|
42 |
+
var n_action_steps = 0
|
43 |
+
|
44 |
+
var _action_space: Dictionary
|
45 |
+
var _action_space_inference: Array[Dictionary] = []
|
46 |
+
var _obs_space: Dictionary
|
47 |
+
|
48 |
+
|
49 |
+
# Called when the node enters the scene tree for the first time.
|
50 |
+
func _ready():
|
51 |
+
await get_tree().root.ready
|
52 |
+
get_tree().set_pause(true)
|
53 |
+
_initialize()
|
54 |
+
await get_tree().create_timer(1.0).timeout
|
55 |
+
get_tree().set_pause(false)
|
56 |
+
|
57 |
+
|
58 |
+
func _initialize():
|
59 |
+
_get_agents()
|
60 |
+
args = _get_args()
|
61 |
+
Engine.physics_ticks_per_second = _get_speedup() * 60 # Replace with function body.
|
62 |
+
Engine.time_scale = _get_speedup() * 1.0
|
63 |
+
prints(
|
64 |
+
"physics ticks",
|
65 |
+
Engine.physics_ticks_per_second,
|
66 |
+
Engine.time_scale,
|
67 |
+
_get_speedup(),
|
68 |
+
speed_up
|
69 |
+
)
|
70 |
+
|
71 |
+
_set_heuristic("human", all_agents)
|
72 |
+
|
73 |
+
_initialize_training_agents()
|
74 |
+
_initialize_inference_agents()
|
75 |
+
_initialize_demo_recording()
|
76 |
+
|
77 |
+
_set_seed()
|
78 |
+
_set_action_repeat()
|
79 |
+
initialized = true
|
80 |
+
|
81 |
+
|
82 |
+
func _initialize_training_agents():
|
83 |
+
if agents_training.size() > 0:
|
84 |
+
_obs_space = agents_training[0].get_obs_space()
|
85 |
+
_action_space = agents_training[0].get_action_space()
|
86 |
+
connected = connect_to_server()
|
87 |
+
if connected:
|
88 |
+
_set_heuristic("model", agents_training)
|
89 |
+
_handshake()
|
90 |
+
_send_env_info()
|
91 |
+
else:
|
92 |
+
push_warning(
|
93 |
+
"Couldn't connect to Python server, using human controls instead. ",
|
94 |
+
"Did you start the training server using e.g. `gdrl` from the console?"
|
95 |
+
)
|
96 |
+
|
97 |
+
|
98 |
+
func _initialize_inference_agents():
|
99 |
+
if agents_inference.size() > 0:
|
100 |
+
if control_mode == ControlModes.ONNX_INFERENCE:
|
101 |
+
assert(
|
102 |
+
FileAccess.file_exists(onnx_model_path),
|
103 |
+
"Onnx Model Path set on Sync node does not exist: %s" % onnx_model_path
|
104 |
+
)
|
105 |
+
onnx_models[onnx_model_path] = ONNXModel.new(onnx_model_path, 1)
|
106 |
+
|
107 |
+
for agent in agents_inference:
|
108 |
+
_action_space_inference.append(agent.get_action_space())
|
109 |
+
|
110 |
+
var agent_onnx_model: ONNXModel
|
111 |
+
if agent.onnx_model_path.is_empty():
|
112 |
+
assert(
|
113 |
+
onnx_models.has(onnx_model_path),
|
114 |
+
(
|
115 |
+
"Node %s has no onnx model path set " % agent.get_path()
|
116 |
+
+ "and sync node's control mode is not set to OnnxInference. "
|
117 |
+
+ "Either add the path to the AIController, "
|
118 |
+
+ "or if you want to use the path set on sync node instead, "
|
119 |
+
+ "set control mode to OnnxInference."
|
120 |
+
)
|
121 |
+
)
|
122 |
+
prints(
|
123 |
+
"Info: AIController %s" % agent.get_path(),
|
124 |
+
"has no onnx model path set.",
|
125 |
+
"Using path set on the sync node instead."
|
126 |
+
)
|
127 |
+
agent_onnx_model = onnx_models[onnx_model_path]
|
128 |
+
else:
|
129 |
+
if not onnx_models.has(agent.onnx_model_path):
|
130 |
+
assert(
|
131 |
+
FileAccess.file_exists(agent.onnx_model_path),
|
132 |
+
(
|
133 |
+
"Onnx Model Path set on %s node does not exist: %s"
|
134 |
+
% [agent.get_path(), agent.onnx_model_path]
|
135 |
+
)
|
136 |
+
)
|
137 |
+
onnx_models[agent.onnx_model_path] = ONNXModel.new(agent.onnx_model_path, 1)
|
138 |
+
agent_onnx_model = onnx_models[agent.onnx_model_path]
|
139 |
+
|
140 |
+
agent.onnx_model = agent_onnx_model
|
141 |
+
_set_heuristic("model", agents_inference)
|
142 |
+
|
143 |
+
|
144 |
+
func _initialize_demo_recording():
|
145 |
+
if agent_demo_record:
|
146 |
+
InputMap.add_action("RemoveLastDemoEpisode")
|
147 |
+
InputMap.action_add_event(
|
148 |
+
"RemoveLastDemoEpisode", agent_demo_record.remove_last_episode_key
|
149 |
+
)
|
150 |
+
current_demo_trajectory.resize(2)
|
151 |
+
current_demo_trajectory[0] = []
|
152 |
+
current_demo_trajectory[1] = []
|
153 |
+
agent_demo_record.heuristic = "demo_record"
|
154 |
+
|
155 |
+
|
156 |
+
func _physics_process(_delta):
|
157 |
+
# two modes, human control, agent control
|
158 |
+
# pause tree, send obs, get actions, set actions, unpause tree
|
159 |
+
|
160 |
+
_demo_record_process()
|
161 |
+
|
162 |
+
if n_action_steps % action_repeat != 0:
|
163 |
+
n_action_steps += 1
|
164 |
+
return
|
165 |
+
|
166 |
+
n_action_steps += 1
|
167 |
+
|
168 |
+
_training_process()
|
169 |
+
_inference_process()
|
170 |
+
_heuristic_process()
|
171 |
+
|
172 |
+
|
173 |
+
func _training_process():
|
174 |
+
if connected:
|
175 |
+
get_tree().set_pause(true)
|
176 |
+
|
177 |
+
if just_reset:
|
178 |
+
just_reset = false
|
179 |
+
var obs = _get_obs_from_agents(agents_training)
|
180 |
+
|
181 |
+
var reply = {"type": "reset", "obs": obs}
|
182 |
+
_send_dict_as_json_message(reply)
|
183 |
+
# this should go straight to getting the action and setting it checked the agent, no need to perform one phyics tick
|
184 |
+
get_tree().set_pause(false)
|
185 |
+
return
|
186 |
+
|
187 |
+
if need_to_send_obs:
|
188 |
+
need_to_send_obs = false
|
189 |
+
var reward = _get_reward_from_agents()
|
190 |
+
var done = _get_done_from_agents()
|
191 |
+
#_reset_agents_if_done() # this ensures the new observation is from the next env instance : NEEDS REFACTOR
|
192 |
+
|
193 |
+
var obs = _get_obs_from_agents(agents_training)
|
194 |
+
|
195 |
+
var reply = {"type": "step", "obs": obs, "reward": reward, "done": done}
|
196 |
+
_send_dict_as_json_message(reply)
|
197 |
+
|
198 |
+
var handled = handle_message()
|
199 |
+
|
200 |
+
|
201 |
+
func _inference_process():
|
202 |
+
if agents_inference.size() > 0:
|
203 |
+
var obs: Array = _get_obs_from_agents(agents_inference)
|
204 |
+
var actions = []
|
205 |
+
|
206 |
+
for agent_id in range(0, agents_inference.size()):
|
207 |
+
var action = agents_inference[agent_id].onnx_model.run_inference(
|
208 |
+
obs[agent_id]["obs"], 1.0
|
209 |
+
)
|
210 |
+
action["output"] = clamp_array(action["output"], -1.0, 1.0)
|
211 |
+
var action_dict = _extract_action_dict(
|
212 |
+
action["output"], _action_space_inference[agent_id]
|
213 |
+
)
|
214 |
+
actions.append(action_dict)
|
215 |
+
|
216 |
+
_set_agent_actions(actions, agents_inference)
|
217 |
+
_reset_agents_if_done(agents_inference)
|
218 |
+
get_tree().set_pause(false)
|
219 |
+
|
220 |
+
|
221 |
+
func _demo_record_process():
|
222 |
+
if not agent_demo_record:
|
223 |
+
return
|
224 |
+
|
225 |
+
if Input.is_action_just_pressed("RemoveLastDemoEpisode"):
|
226 |
+
print("[Sync script][Demo recorder] Removing last recorded episode.")
|
227 |
+
demo_trajectories.remove_at(demo_trajectories.size() - 1)
|
228 |
+
print("Remaining episode count: %d" % demo_trajectories.size())
|
229 |
+
|
230 |
+
if n_action_steps % agent_demo_record.action_repeat != 0:
|
231 |
+
return
|
232 |
+
|
233 |
+
var obs_dict: Dictionary = agent_demo_record.get_obs()
|
234 |
+
|
235 |
+
# Get the current obs from the agent
|
236 |
+
assert(
|
237 |
+
obs_dict.has("obs"),
|
238 |
+
"Demo recorder needs an 'obs' key in get_obs() returned dictionary to record obs from."
|
239 |
+
)
|
240 |
+
current_demo_trajectory[0].append(obs_dict.obs)
|
241 |
+
|
242 |
+
# Get the action applied for the current obs from the agent
|
243 |
+
agent_demo_record.set_action()
|
244 |
+
var acts = agent_demo_record.get_action()
|
245 |
+
|
246 |
+
var terminal = agent_demo_record.get_done()
|
247 |
+
# Record actions only for non-terminal states
|
248 |
+
if terminal:
|
249 |
+
agent_demo_record.set_done_false()
|
250 |
+
else:
|
251 |
+
current_demo_trajectory[1].append(acts)
|
252 |
+
|
253 |
+
if terminal:
|
254 |
+
#current_demo_trajectory[2].append(true)
|
255 |
+
demo_trajectories.append(current_demo_trajectory.duplicate(true))
|
256 |
+
print("[Sync script][Demo recorder] Recorded episode count: %d" % demo_trajectories.size())
|
257 |
+
current_demo_trajectory[0].clear()
|
258 |
+
current_demo_trajectory[1].clear()
|
259 |
+
|
260 |
+
|
261 |
+
func _heuristic_process():
|
262 |
+
for agent in agents_heuristic:
|
263 |
+
_reset_agents_if_done(agents_heuristic)
|
264 |
+
|
265 |
+
|
266 |
+
func _extract_action_dict(action_array: Array, action_space: Dictionary):
|
267 |
+
var index = 0
|
268 |
+
var result = {}
|
269 |
+
for key in action_space.keys():
|
270 |
+
var size = action_space[key]["size"]
|
271 |
+
if action_space[key]["action_type"] == "discrete":
|
272 |
+
result[key] = round(action_array[index])
|
273 |
+
else:
|
274 |
+
result[key] = action_array.slice(index, index + size)
|
275 |
+
index += size
|
276 |
+
|
277 |
+
return result
|
278 |
+
|
279 |
+
|
280 |
+
## For AIControllers that inherit mode from sync, sets the correct mode.
|
281 |
+
func _set_agent_mode(agent: Node):
|
282 |
+
var agent_inherits_mode: bool = agent.control_mode == agent.ControlModes.INHERIT_FROM_SYNC
|
283 |
+
|
284 |
+
if agent_inherits_mode:
|
285 |
+
match control_mode:
|
286 |
+
ControlModes.HUMAN:
|
287 |
+
agent.control_mode = agent.ControlModes.HUMAN
|
288 |
+
ControlModes.TRAINING:
|
289 |
+
agent.control_mode = agent.ControlModes.TRAINING
|
290 |
+
ControlModes.ONNX_INFERENCE:
|
291 |
+
agent.control_mode = agent.ControlModes.ONNX_INFERENCE
|
292 |
+
|
293 |
+
|
294 |
+
func _get_agents():
|
295 |
+
all_agents = get_tree().get_nodes_in_group("AGENT")
|
296 |
+
for agent in all_agents:
|
297 |
+
_set_agent_mode(agent)
|
298 |
+
|
299 |
+
if agent.control_mode == agent.ControlModes.TRAINING:
|
300 |
+
agents_training.append(agent)
|
301 |
+
elif agent.control_mode == agent.ControlModes.ONNX_INFERENCE:
|
302 |
+
agents_inference.append(agent)
|
303 |
+
elif agent.control_mode == agent.ControlModes.HUMAN:
|
304 |
+
agents_heuristic.append(agent)
|
305 |
+
elif agent.control_mode == agent.ControlModes.RECORD_EXPERT_DEMOS:
|
306 |
+
assert(
|
307 |
+
not agent_demo_record,
|
308 |
+
"Currently only a single AIController can be used for recording expert demos."
|
309 |
+
)
|
310 |
+
agent_demo_record = agent
|
311 |
+
|
312 |
+
|
313 |
+
func _set_heuristic(heuristic, agents: Array):
|
314 |
+
for agent in agents:
|
315 |
+
agent.set_heuristic(heuristic)
|
316 |
+
|
317 |
+
|
318 |
+
func _handshake():
|
319 |
+
print("performing handshake")
|
320 |
+
|
321 |
+
var json_dict = _get_dict_json_message()
|
322 |
+
assert(json_dict["type"] == "handshake")
|
323 |
+
var major_version = json_dict["major_version"]
|
324 |
+
var minor_version = json_dict["minor_version"]
|
325 |
+
if major_version != MAJOR_VERSION:
|
326 |
+
print("WARNING: major verison mismatch ", major_version, " ", MAJOR_VERSION)
|
327 |
+
if minor_version != MINOR_VERSION:
|
328 |
+
print("WARNING: minor verison mismatch ", minor_version, " ", MINOR_VERSION)
|
329 |
+
|
330 |
+
print("handshake complete")
|
331 |
+
|
332 |
+
|
333 |
+
func _get_dict_json_message():
|
334 |
+
# returns a dictionary from of the most recent message
|
335 |
+
# this is not waiting
|
336 |
+
while stream.get_available_bytes() == 0:
|
337 |
+
stream.poll()
|
338 |
+
if stream.get_status() != 2:
|
339 |
+
print("server disconnected status, closing")
|
340 |
+
get_tree().quit()
|
341 |
+
return null
|
342 |
+
|
343 |
+
OS.delay_usec(10)
|
344 |
+
|
345 |
+
var message = stream.get_string()
|
346 |
+
var json_data = JSON.parse_string(message)
|
347 |
+
|
348 |
+
return json_data
|
349 |
+
|
350 |
+
|
351 |
+
func _send_dict_as_json_message(dict):
|
352 |
+
stream.put_string(JSON.stringify(dict, "", false))
|
353 |
+
|
354 |
+
|
355 |
+
func _send_env_info():
|
356 |
+
var json_dict = _get_dict_json_message()
|
357 |
+
assert(json_dict["type"] == "env_info")
|
358 |
+
|
359 |
+
var message = {
|
360 |
+
"type": "env_info",
|
361 |
+
"observation_space": _obs_space,
|
362 |
+
"action_space": _action_space,
|
363 |
+
"n_agents": len(agents_training)
|
364 |
+
}
|
365 |
+
_send_dict_as_json_message(message)
|
366 |
+
|
367 |
+
|
368 |
+
func connect_to_server():
|
369 |
+
print("Waiting for one second to allow server to start")
|
370 |
+
OS.delay_msec(1000)
|
371 |
+
print("trying to connect to server")
|
372 |
+
stream = StreamPeerTCP.new()
|
373 |
+
|
374 |
+
# "localhost" was not working on windows VM, had to use the IP
|
375 |
+
var ip = "127.0.0.1"
|
376 |
+
var port = _get_port()
|
377 |
+
var connect = stream.connect_to_host(ip, port)
|
378 |
+
stream.set_no_delay(true) # TODO check if this improves performance or not
|
379 |
+
stream.poll()
|
380 |
+
# Fetch the status until it is either connected (2) or failed to connect (3)
|
381 |
+
while stream.get_status() < 2:
|
382 |
+
stream.poll()
|
383 |
+
return stream.get_status() == 2
|
384 |
+
|
385 |
+
|
386 |
+
func _get_args():
|
387 |
+
print("getting command line arguments")
|
388 |
+
var arguments = {}
|
389 |
+
for argument in OS.get_cmdline_args():
|
390 |
+
print(argument)
|
391 |
+
if argument.find("=") > -1:
|
392 |
+
var key_value = argument.split("=")
|
393 |
+
arguments[key_value[0].lstrip("--")] = key_value[1]
|
394 |
+
else:
|
395 |
+
# Options without an argument will be present in the dictionary,
|
396 |
+
# with the value set to an empty string.
|
397 |
+
arguments[argument.lstrip("--")] = ""
|
398 |
+
|
399 |
+
return arguments
|
400 |
+
|
401 |
+
|
402 |
+
func _get_speedup():
|
403 |
+
print(args)
|
404 |
+
return args.get("speedup", str(speed_up)).to_float()
|
405 |
+
|
406 |
+
|
407 |
+
func _get_port():
|
408 |
+
return args.get("port", DEFAULT_PORT).to_int()
|
409 |
+
|
410 |
+
|
411 |
+
func _set_seed():
|
412 |
+
var _seed = args.get("env_seed", DEFAULT_SEED).to_int()
|
413 |
+
seed(_seed)
|
414 |
+
|
415 |
+
|
416 |
+
func _set_action_repeat():
|
417 |
+
action_repeat = args.get("action_repeat", str(action_repeat)).to_int()
|
418 |
+
|
419 |
+
|
420 |
+
func disconnect_from_server():
|
421 |
+
stream.disconnect_from_host()
|
422 |
+
|
423 |
+
|
424 |
+
func handle_message() -> bool:
|
425 |
+
# get json message: reset, step, close
|
426 |
+
var message = _get_dict_json_message()
|
427 |
+
if message["type"] == "close":
|
428 |
+
print("received close message, closing game")
|
429 |
+
get_tree().quit()
|
430 |
+
get_tree().set_pause(false)
|
431 |
+
return true
|
432 |
+
|
433 |
+
if message["type"] == "reset":
|
434 |
+
print("resetting all agents")
|
435 |
+
_reset_agents()
|
436 |
+
just_reset = true
|
437 |
+
get_tree().set_pause(false)
|
438 |
+
#print("resetting forcing draw")
|
439 |
+
# RenderingServer.force_draw()
|
440 |
+
# var obs = _get_obs_from_agents()
|
441 |
+
# print("obs ", obs)
|
442 |
+
# var reply = {
|
443 |
+
# "type": "reset",
|
444 |
+
# "obs": obs
|
445 |
+
# }
|
446 |
+
# _send_dict_as_json_message(reply)
|
447 |
+
return true
|
448 |
+
|
449 |
+
if message["type"] == "call":
|
450 |
+
var method = message["method"]
|
451 |
+
var returns = _call_method_on_agents(method)
|
452 |
+
var reply = {"type": "call", "returns": returns}
|
453 |
+
print("calling method from Python")
|
454 |
+
_send_dict_as_json_message(reply)
|
455 |
+
return handle_message()
|
456 |
+
|
457 |
+
if message["type"] == "action":
|
458 |
+
var action = message["action"]
|
459 |
+
_set_agent_actions(action, agents_training)
|
460 |
+
need_to_send_obs = true
|
461 |
+
get_tree().set_pause(false)
|
462 |
+
return true
|
463 |
+
|
464 |
+
print("message was not handled")
|
465 |
+
return false
|
466 |
+
|
467 |
+
|
468 |
+
func _call_method_on_agents(method):
|
469 |
+
var returns = []
|
470 |
+
for agent in all_agents:
|
471 |
+
returns.append(agent.call(method))
|
472 |
+
|
473 |
+
return returns
|
474 |
+
|
475 |
+
|
476 |
+
func _reset_agents_if_done(agents = all_agents):
|
477 |
+
for agent in agents:
|
478 |
+
if agent.get_done():
|
479 |
+
agent.set_done_false()
|
480 |
+
|
481 |
+
|
482 |
+
func _reset_agents(agents = all_agents):
|
483 |
+
for agent in agents:
|
484 |
+
agent.needs_reset = true
|
485 |
+
#agent.reset()
|
486 |
+
|
487 |
+
|
488 |
+
func _get_obs_from_agents(agents: Array = all_agents):
|
489 |
+
var obs = []
|
490 |
+
for agent in agents:
|
491 |
+
obs.append(agent.get_obs())
|
492 |
+
return obs
|
493 |
+
|
494 |
+
|
495 |
+
func _get_reward_from_agents(agents: Array = agents_training):
|
496 |
+
var rewards = []
|
497 |
+
for agent in agents:
|
498 |
+
rewards.append(agent.get_reward())
|
499 |
+
agent.zero_reward()
|
500 |
+
return rewards
|
501 |
+
|
502 |
+
|
503 |
+
func _get_done_from_agents(agents: Array = agents_training):
|
504 |
+
var dones = []
|
505 |
+
for agent in agents:
|
506 |
+
var done = agent.get_done()
|
507 |
+
if done:
|
508 |
+
agent.set_done_false()
|
509 |
+
dones.append(done)
|
510 |
+
return dones
|
511 |
+
|
512 |
+
|
513 |
+
func _set_agent_actions(actions, agents: Array = all_agents):
|
514 |
+
for i in range(len(actions)):
|
515 |
+
agents[i].set_action(actions[i])
|
516 |
+
|
517 |
+
|
518 |
+
func clamp_array(arr: Array, min: float, max: float):
|
519 |
+
var output: Array = []
|
520 |
+
for a in arr:
|
521 |
+
output.append(clamp(a, min, max))
|
522 |
+
return output
|
523 |
+
|
524 |
+
|
525 |
+
## Save recorded export demos on window exit (Close window instead of "Stop" button in Godot Editor)
|
526 |
+
func _notification(what):
|
527 |
+
if not agent_demo_record:
|
528 |
+
return
|
529 |
+
|
530 |
+
if what == NOTIFICATION_PREDELETE:
|
531 |
+
var json_string = JSON.stringify(demo_trajectories, "", false)
|
532 |
+
var file = FileAccess.open(agent_demo_record.expert_demo_save_path, FileAccess.WRITE)
|
533 |
+
|
534 |
+
if not file:
|
535 |
+
var error: Error = FileAccess.get_open_error()
|
536 |
+
assert(not error, "There was an error opening the file: %d" % error)
|
537 |
+
|
538 |
+
file.store_line(json_string)
|
539 |
+
var error = file.get_error()
|
540 |
+
assert(not error, "There was an error after trying to write to the file: %d" % error)
|
asset-license.md
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Robot Volleyball Environment made by Ivan-267 using Godot, Godot RL Agents, and Blender.
|
2 |
+
|
3 |
+
The following license is only for the assets (.blend files and .png files) in the folder "blender" and "sky.exr" file in the folder "textures":
|
4 |
+
Author: https://github.com/Ivan-267
|
5 |
+
License: https://creativecommons.org/licenses/by/4.0/
|
blender/grass.png
ADDED
Git LFS Details
|
blender/grass.png.import
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[remap]
|
2 |
+
|
3 |
+
importer="texture"
|
4 |
+
type="CompressedTexture2D"
|
5 |
+
uid="uid://reniywu36w53"
|
6 |
+
path.s3tc="res://.godot/imported/grass.png-7c60bca28d3e258c95ae66b2cb59fde0.s3tc.ctex"
|
7 |
+
metadata={
|
8 |
+
"imported_formats": ["s3tc_bptc"],
|
9 |
+
"vram_texture": true
|
10 |
+
}
|
11 |
+
|
12 |
+
[deps]
|
13 |
+
|
14 |
+
source_file="res://blender/grass.png"
|
15 |
+
dest_files=["res://.godot/imported/grass.png-7c60bca28d3e258c95ae66b2cb59fde0.s3tc.ctex"]
|
16 |
+
|
17 |
+
[params]
|
18 |
+
|
19 |
+
compress/mode=2
|
20 |
+
compress/high_quality=false
|
21 |
+
compress/lossy_quality=0.7
|
22 |
+
compress/hdr_compression=1
|
23 |
+
compress/normal_map=0
|
24 |
+
compress/channel_pack=0
|
25 |
+
mipmaps/generate=true
|
26 |
+
mipmaps/limit=-1
|
27 |
+
roughness/mode=0
|
28 |
+
roughness/src_normal=""
|
29 |
+
process/fix_alpha_border=true
|
30 |
+
process/premult_alpha=false
|
31 |
+
process/normal_map_invert_y=false
|
32 |
+
process/hdr_as_srgb=false
|
33 |
+
process/hdr_clamp_exposure=false
|
34 |
+
process/size_limit=0
|
35 |
+
detect_3d/compress_to=0
|
blender/grass2.png
ADDED
Git LFS Details
|
blender/grass2.png.import
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[remap]
|
2 |
+
|
3 |
+
importer="texture"
|
4 |
+
type="CompressedTexture2D"
|
5 |
+
uid="uid://bw17xikr306pk"
|
6 |
+
path.s3tc="res://.godot/imported/grass2.png-78f3f5853690f61c10bfe2b1abe760c7.s3tc.ctex"
|
7 |
+
metadata={
|
8 |
+
"imported_formats": ["s3tc_bptc"],
|
9 |
+
"vram_texture": true
|
10 |
+
}
|
11 |
+
|
12 |
+
[deps]
|
13 |
+
|
14 |
+
source_file="res://blender/grass2.png"
|
15 |
+
dest_files=["res://.godot/imported/grass2.png-78f3f5853690f61c10bfe2b1abe760c7.s3tc.ctex"]
|
16 |
+
|
17 |
+
[params]
|
18 |
+
|
19 |
+
compress/mode=2
|
20 |
+
compress/high_quality=false
|
21 |
+
compress/lossy_quality=0.7
|
22 |
+
compress/hdr_compression=1
|
23 |
+
compress/normal_map=0
|
24 |
+
compress/channel_pack=0
|
25 |
+
mipmaps/generate=true
|
26 |
+
mipmaps/limit=-1
|
27 |
+
roughness/mode=0
|
28 |
+
roughness/src_normal=""
|
29 |
+
process/fix_alpha_border=true
|
30 |
+
process/premult_alpha=false
|
31 |
+
process/normal_map_invert_y=false
|
32 |
+
process/hdr_as_srgb=false
|
33 |
+
process/hdr_clamp_exposure=false
|
34 |
+
process/size_limit=0
|
35 |
+
detect_3d/compress_to=0
|
blender/grass3.png
ADDED
Git LFS Details
|
blender/grass3.png.import
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[remap]
|
2 |
+
|
3 |
+
importer="texture"
|
4 |
+
type="CompressedTexture2D"
|
5 |
+
uid="uid://dnfhyo3hoj2gl"
|
6 |
+
path.s3tc="res://.godot/imported/grass3.png-619be532ec319cef268c429d31b8d2fb.s3tc.ctex"
|
7 |
+
metadata={
|
8 |
+
"imported_formats": ["s3tc_bptc"],
|
9 |
+
"vram_texture": true
|
10 |
+
}
|
11 |
+
|
12 |
+
[deps]
|
13 |
+
|
14 |
+
source_file="res://blender/grass3.png"
|
15 |
+
dest_files=["res://.godot/imported/grass3.png-619be532ec319cef268c429d31b8d2fb.s3tc.ctex"]
|
16 |
+
|
17 |
+
[params]
|
18 |
+
|
19 |
+
compress/mode=2
|
20 |
+
compress/high_quality=false
|
21 |
+
compress/lossy_quality=0.7
|
22 |
+
compress/hdr_compression=1
|
23 |
+
compress/normal_map=0
|
24 |
+
compress/channel_pack=0
|
25 |
+
mipmaps/generate=true
|
26 |
+
mipmaps/limit=-1
|
27 |
+
roughness/mode=0
|
28 |
+
roughness/src_normal=""
|
29 |
+
process/fix_alpha_border=true
|
30 |
+
process/premult_alpha=false
|
31 |
+
process/normal_map_invert_y=false
|
32 |
+
process/hdr_as_srgb=false
|
33 |
+
process/hdr_clamp_exposure=false
|
34 |
+
process/size_limit=0
|
35 |
+
detect_3d/compress_to=0
|
blender/robot.blend
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:51b1b6e2ac27c8e83e3e248658f40094c8d8336dc71c7dcd670777085f36b5c4
|
3 |
+
size 1022824
|
blender/robot.blend.import
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[remap]
|
2 |
+
|
3 |
+
importer="scene"
|
4 |
+
importer_version=1
|
5 |
+
type="PackedScene"
|
6 |
+
uid="uid://coxcc242eehiq"
|
7 |
+
path="res://.godot/imported/robot.blend-000de9eae232532a839543b86cedcbd7.scn"
|
8 |
+
|
9 |
+
[deps]
|
10 |
+
|
11 |
+
source_file="res://blender/robot.blend"
|
12 |
+
dest_files=["res://.godot/imported/robot.blend-000de9eae232532a839543b86cedcbd7.scn"]
|
13 |
+
|
14 |
+
[params]
|
15 |
+
|
16 |
+
nodes/root_type=""
|
17 |
+
nodes/root_name=""
|
18 |
+
nodes/apply_root_scale=true
|
19 |
+
nodes/root_scale=1.0
|
20 |
+
meshes/ensure_tangents=true
|
21 |
+
meshes/generate_lods=true
|
22 |
+
meshes/create_shadow_meshes=true
|
23 |
+
meshes/light_baking=1
|
24 |
+
meshes/lightmap_texel_size=0.2
|
25 |
+
meshes/force_disable_compression=false
|
26 |
+
skins/use_named_skins=true
|
27 |
+
animation/import=true
|
28 |
+
animation/fps=30
|
29 |
+
animation/trimming=false
|
30 |
+
animation/remove_immutable_tracks=true
|
31 |
+
import_script/path=""
|
32 |
+
_subresources={}
|
33 |
+
gltf/naming_version=1
|
34 |
+
gltf/embedded_image_handling=1
|
35 |
+
blender/nodes/visible=0
|
36 |
+
blender/nodes/punctual_lights=true
|
37 |
+
blender/nodes/cameras=true
|
38 |
+
blender/nodes/custom_properties=true
|
39 |
+
blender/nodes/modifiers=1
|
40 |
+
blender/meshes/colors=false
|
41 |
+
blender/meshes/uvs=true
|
42 |
+
blender/meshes/normals=true
|
43 |
+
blender/meshes/tangents=true
|
44 |
+
blender/meshes/skins=2
|
45 |
+
blender/meshes/export_bones_deforming_mesh_only=false
|
46 |
+
blender/materials/unpack_enabled=true
|
47 |
+
blender/materials/export_materials=1
|
48 |
+
blender/animation/limit_playback=true
|
49 |
+
blender/animation/always_sample=true
|
50 |
+
blender/animation/group_tracks=true
|
blender/static_decorations.blend
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ed8b8c79a7bbf057c6b1964854079a33ffd232f55bd5f7f98ecdd9489b7e20b3
|
3 |
+
size 1223728
|
blender/static_decorations.blend.import
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[remap]
|
2 |
+
|
3 |
+
importer="scene"
|
4 |
+
importer_version=1
|
5 |
+
type="PackedScene"
|
6 |
+
uid="uid://crjcvbws8ufmj"
|
7 |
+
path="res://.godot/imported/static_decorations.blend-3cedede138a358d5281e8d83b3ae557b.scn"
|
8 |
+
|
9 |
+
[deps]
|
10 |
+
|
11 |
+
source_file="res://blender/static_decorations.blend"
|
12 |
+
dest_files=["res://.godot/imported/static_decorations.blend-3cedede138a358d5281e8d83b3ae557b.scn"]
|
13 |
+
|
14 |
+
[params]
|
15 |
+
|
16 |
+
nodes/root_type=""
|
17 |
+
nodes/root_name=""
|
18 |
+
nodes/apply_root_scale=true
|
19 |
+
nodes/root_scale=1.0
|
20 |
+
meshes/ensure_tangents=true
|
21 |
+
meshes/generate_lods=true
|
22 |
+
meshes/create_shadow_meshes=true
|
23 |
+
meshes/light_baking=1
|
24 |
+
meshes/lightmap_texel_size=0.2
|
25 |
+
meshes/force_disable_compression=false
|
26 |
+
skins/use_named_skins=true
|
27 |
+
animation/import=true
|
28 |
+
animation/fps=30
|
29 |
+
animation/trimming=false
|
30 |
+
animation/remove_immutable_tracks=true
|
31 |
+
import_script/path=""
|
32 |
+
_subresources={}
|
33 |
+
gltf/naming_version=1
|
34 |
+
gltf/embedded_image_handling=1
|
35 |
+
blender/nodes/visible=0
|
36 |
+
blender/nodes/punctual_lights=true
|
37 |
+
blender/nodes/cameras=true
|
38 |
+
blender/nodes/custom_properties=true
|
39 |
+
blender/nodes/modifiers=1
|
40 |
+
blender/meshes/colors=false
|
41 |
+
blender/meshes/uvs=true
|
42 |
+
blender/meshes/normals=true
|
43 |
+
blender/meshes/tangents=true
|
44 |
+
blender/meshes/skins=2
|
45 |
+
blender/meshes/export_bones_deforming_mesh_only=false
|
46 |
+
blender/materials/unpack_enabled=true
|
47 |
+
blender/materials/export_materials=1
|
48 |
+
blender/animation/limit_playback=true
|
49 |
+
blender/animation/always_sample=true
|
50 |
+
blender/animation/group_tracks=true
|
icon.svg
ADDED
icon.svg.import
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[remap]
|
2 |
+
|
3 |
+
importer="texture"
|
4 |
+
type="CompressedTexture2D"
|
5 |
+
uid="uid://bldutp5f6tmtx"
|
6 |
+
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
7 |
+
metadata={
|
8 |
+
"vram_texture": false
|
9 |
+
}
|
10 |
+
|
11 |
+
[deps]
|
12 |
+
|
13 |
+
source_file="res://icon.svg"
|
14 |
+
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
15 |
+
|
16 |
+
[params]
|
17 |
+
|
18 |
+
compress/mode=0
|
19 |
+
compress/high_quality=false
|
20 |
+
compress/lossy_quality=0.7
|
21 |
+
compress/hdr_compression=1
|
22 |
+
compress/normal_map=0
|
23 |
+
compress/channel_pack=0
|
24 |
+
mipmaps/generate=false
|
25 |
+
mipmaps/limit=-1
|
26 |
+
roughness/mode=0
|
27 |
+
roughness/src_normal=""
|
28 |
+
process/fix_alpha_border=true
|
29 |
+
process/premult_alpha=false
|
30 |
+
process/normal_map_invert_y=false
|
31 |
+
process/hdr_as_srgb=false
|
32 |
+
process/hdr_clamp_exposure=false
|
33 |
+
process/size_limit=0
|
34 |
+
detect_3d/compress_to=1
|
35 |
+
svg/scale=1.0
|
36 |
+
editor/scale_with_editor_scale=false
|
37 |
+
editor/convert_colors_with_editor_theme=false
|
onnx/volleyball.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:33e71a5aa6421ae9c92af5d3bd83bca25854ae46bac607ae56bb731ce219a577
|
3 |
+
size 23502
|
project.godot
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
; Engine configuration file.
|
2 |
+
; It's best edited using the editor UI and not directly,
|
3 |
+
; since the parameters that go here are not all obvious.
|
4 |
+
;
|
5 |
+
; Format:
|
6 |
+
; [section] ; section goes between []
|
7 |
+
; param=value ; assign values to parameters
|
8 |
+
|
9 |
+
config_version=5
|
10 |
+
|
11 |
+
[application]
|
12 |
+
|
13 |
+
config/name="RobotVolleyball"
|
14 |
+
run/main_scene="res://scenes/training_scene/training_scene.tscn"
|
15 |
+
config/features=PackedStringArray("4.2", "C#", "Forward Plus")
|
16 |
+
config/icon="res://icon.svg"
|
17 |
+
|
18 |
+
[display]
|
19 |
+
|
20 |
+
window/size/mode=4
|
21 |
+
|
22 |
+
[dotnet]
|
23 |
+
|
24 |
+
project/assembly_name="RobotVolleyball"
|
25 |
+
|
26 |
+
[editor_plugins]
|
27 |
+
|
28 |
+
enabled=PackedStringArray("res://addons/godot_rl_agents/plugin.cfg")
|
29 |
+
|
30 |
+
[input]
|
31 |
+
|
32 |
+
move_left={
|
33 |
+
"deadzone": 0.5,
|
34 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
|
35 |
+
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
|
36 |
+
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":true,"script":null)
|
37 |
+
]
|
38 |
+
}
|
39 |
+
move_right={
|
40 |
+
"deadzone": 0.5,
|
41 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
42 |
+
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
|
43 |
+
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":true,"script":null)
|
44 |
+
]
|
45 |
+
}
|
46 |
+
jump={
|
47 |
+
"deadzone": 0.5,
|
48 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
|
49 |
+
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
|
50 |
+
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
|
51 |
+
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
52 |
+
]
|
53 |
+
}
|
54 |
+
|
55 |
+
[physics]
|
56 |
+
|
57 |
+
3d/default_linear_damp=0.0
|
58 |
+
3d/default_angular_damp=0.0
|
readme.md
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Robot Volleyball
|
2 |
+
|
3 |
+
A simple minigame arcade-style Volleyball example with AI vs AI and Human VS AI modes.
|
4 |
+
|
5 |
+
### Observations:
|
6 |
+
- Position of the ball in robot's local reference,
|
7 |
+
- Position of the ball in the robot's goal's local reference (to tell on what side of the field the ball is in),
|
8 |
+
- Velocity of the robot in robot's local reference,
|
9 |
+
- Velocity of the ball in robot's local reference,
|
10 |
+
- Whether the jump sensor is colliding (which means that the robot can jump),
|
11 |
+
- Whether the robot is serving,
|
12 |
+
- Whether the ball has been served,
|
13 |
+
- Hit count of the ball in a row (hitting the ball more than 2 times in a row by the same robot causes a fault),
|
14 |
+
- How many steps has passed without hitting the ball (only counted if serving, there is a time limit in that case).
|
15 |
+
|
16 |
+
### Action space:
|
17 |
+
```gdscript
|
18 |
+
func get_action_space() -> Dictionary:
|
19 |
+
return {
|
20 |
+
"jump": {"size": 1, "action_type": "continuous"},
|
21 |
+
"movement": {"size": 1, "action_type": "continuous"}
|
22 |
+
}
|
23 |
+
```
|
24 |
+
|
25 |
+
### Rewards:
|
26 |
+
- Positive reward for hitting the ball once when serving,
|
27 |
+
- Negative reward if the same robot hits the ball more than 2 times in a row,
|
28 |
+
- Negative reward if the ball hits the robots own goal
|
29 |
+
|
30 |
+
### Game over / episode end conditions:
|
31 |
+
In infinite game mode or training mode, there are no specified end conditions.
|
32 |
+
It's possible to disable these modes in the GameScene node in which case a winner will be announced,
|
33 |
+
and the scores will be restarted, after a certain amount of points is reached.
|
34 |
+
|
35 |
+
### Running inference:
|
36 |
+
#### AI vs AI
|
37 |
+
Open the scene `res://scenes/testing_scenes/ai_vs_ai.tscn` in Godot Editor, and press `F6` or click on `Run Current Scene`.
|
38 |
+
|
39 |
+
#### Human vs AI
|
40 |
+
To play VS the AI, open the scene `res://scenes/testing_scenes/human_vs_ai.tscn` in Godot Editor, and press `F6` or click on `Run Current Scene`.
|
41 |
+
|
42 |
+
Controls (you can adjust them in Project Settings in Godot Editor):
|
43 |
+
|
44 |
+
![Volleyball Controls](https://github.com/edbeeching/godot_rl_agents_examples/assets/61947090/26809560-815d-4d8e-b3ea-2f539a9e1fa3)
|
45 |
+
|
46 |
+
### Training:
|
47 |
+
The default scene `res://scenes/training_scene/training_scene.tscn` can be used for training.
|
48 |
+
|
49 |
+
These were the parameters used to train the included onnx file (they can be applied by modifying [stable_baselines3_example.py](https://github.com/edbeeching/godot_rl_agents/blob/main/examples/stable_baselines3_example.py)):
|
50 |
+
```python
|
51 |
+
policy_kwargs = dict(log_std_init=log(1.0))
|
52 |
+
model: PPO = PPO("MultiInputPolicy", env, verbose=1, n_epochs=10, learning_rate=0.0003, clip_range=0.2, ent_coef=0.0085, n_steps=128, batch_size=160, policy_kwargs=policy_kwargs, tensorboard_log=args.experiment_dir)
|
53 |
+
```
|
54 |
+
|
55 |
+
The arguments provided to the example for training were (feel free to adjust these):
|
56 |
+
```bash
|
57 |
+
--timesteps=6_500_000
|
58 |
+
--n_parallel=5
|
59 |
+
--speedup=15
|
60 |
+
--env_path=[write the path to exported exe file here or remove this and n_parallel above for in-editor training]
|
61 |
+
--onnx_export_path=volleyball.onnx
|
62 |
+
```
|
63 |
+
|
scenes/game_scene/ball.gd
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends RigidBody3D
|
2 |
+
class_name Ball
|
3 |
+
|
4 |
+
@export var max_velocity: float = 8.0
|
5 |
+
|
6 |
+
var is_resetting: bool
|
7 |
+
var ball_served: bool
|
8 |
+
var new_position: Vector3
|
9 |
+
|
10 |
+
|
11 |
+
func _integrate_forces(state):
|
12 |
+
state.linear_velocity = state.linear_velocity.limit_length(max_velocity)
|
13 |
+
|
14 |
+
|
15 |
+
func reset(position_after_reset: Vector3):
|
16 |
+
ball_served = false
|
17 |
+
is_resetting = true
|
18 |
+
gravity_scale = 0
|
19 |
+
linear_velocity = Vector3.ZERO
|
20 |
+
angular_velocity = Vector3.ZERO
|
21 |
+
global_position = position_after_reset
|
22 |
+
new_position = position_after_reset
|
23 |
+
|
24 |
+
|
25 |
+
func _on_body_entered(body):
|
26 |
+
if ball_served:
|
27 |
+
return
|
28 |
+
|
29 |
+
var player = body as Robot
|
30 |
+
|
31 |
+
if player and player.ai_controller.is_serving and not ball_served:
|
32 |
+
ball_served = true
|
33 |
+
player.ai_controller.is_serving = false
|
34 |
+
gravity_scale = 1.45
|
scenes/game_scene/game_manager.gd
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## TODO: Try not ending episodes, just giving the rewards.
|
2 |
+
|
3 |
+
extends Node3D
|
4 |
+
class_name GameManager
|
5 |
+
|
6 |
+
@export var players: Array[Robot]
|
7 |
+
|
8 |
+
## Training mode disables UI and game-resetting
|
9 |
+
@export var training_mode: bool = true
|
10 |
+
## Applies if the training mode is disabled
|
11 |
+
@export var infinite_game: bool = true
|
12 |
+
## Applies if the training mode is disabled
|
13 |
+
@export var victory_at_score: int = 11
|
14 |
+
@export var ui: UI
|
15 |
+
|
16 |
+
var ball_hit_in_row_count: int
|
17 |
+
var last_ball_hit_player: Robot
|
18 |
+
|
19 |
+
@onready var ball = $Ball
|
20 |
+
|
21 |
+
var game_just_reset: bool = false
|
22 |
+
|
23 |
+
|
24 |
+
func get_hit_ball_count(robot: Robot):
|
25 |
+
if last_ball_hit_player != robot:
|
26 |
+
return 0.0
|
27 |
+
return ball_hit_in_row_count / 2.0
|
28 |
+
|
29 |
+
|
30 |
+
func _ready():
|
31 |
+
for player in players:
|
32 |
+
player.ball = ball
|
33 |
+
player.game_manager = self
|
34 |
+
activate_game_reset()
|
35 |
+
|
36 |
+
|
37 |
+
func _physics_process(_delta):
|
38 |
+
if ball.global_position.y < -2:
|
39 |
+
activate_game_reset()
|
40 |
+
|
41 |
+
if game_just_reset and not training_mode:
|
42 |
+
reset_ball(players.pick_random())
|
43 |
+
process_mode = Node.PROCESS_MODE_DISABLED
|
44 |
+
ui.show_get_ready_text(3)
|
45 |
+
await get_tree().create_timer(3, true, true).timeout
|
46 |
+
game_just_reset = false
|
47 |
+
|
48 |
+
for player in players:
|
49 |
+
player = player as Robot
|
50 |
+
player.score = 0
|
51 |
+
player.global_position = player.initial_position
|
52 |
+
player.linear_velocity = Vector3.ZERO
|
53 |
+
|
54 |
+
ball_hit_in_row_count = 0
|
55 |
+
process_mode = Node.PROCESS_MODE_ALWAYS
|
56 |
+
|
57 |
+
|
58 |
+
func _on_ball_body_entered(body):
|
59 |
+
var player = body as Robot
|
60 |
+
if player:
|
61 |
+
if not ball.ball_served:
|
62 |
+
player.ai_controller.reward += 1.0
|
63 |
+
|
64 |
+
if last_ball_hit_player == player:
|
65 |
+
ball_hit_in_row_count += 1
|
66 |
+
else:
|
67 |
+
ball_hit_in_row_count = 1
|
68 |
+
last_ball_hit_player = player
|
69 |
+
|
70 |
+
if ball_hit_in_row_count > 2:
|
71 |
+
player.ai_controller.reward -= 1.0
|
72 |
+
player.other_player.score += 1
|
73 |
+
reset_ball(player.other_player)
|
74 |
+
|
75 |
+
|
76 |
+
func handle_goal_hit(goal: Area3D):
|
77 |
+
for player in players:
|
78 |
+
if player.goal == goal:
|
79 |
+
player.ai_controller.reward -= 1.0
|
80 |
+
player.other_player.score += 1
|
81 |
+
reset_ball(player.other_player)
|
82 |
+
|
83 |
+
|
84 |
+
func calc_ball_position(player: Robot):
|
85 |
+
return player.initial_position + Vector3.UP * 1.1 + Vector3.RIGHT * randf_range(-0.5, 0.5)
|
86 |
+
|
87 |
+
|
88 |
+
func _on_goal_ball_entered(goal):
|
89 |
+
handle_goal_hit(goal)
|
90 |
+
|
91 |
+
|
92 |
+
func reset_ball(player: Robot):
|
93 |
+
handle_victory(player)
|
94 |
+
ball_hit_in_row_count = 0
|
95 |
+
ball.ball_served = false
|
96 |
+
player.ai_controller.is_serving = true
|
97 |
+
player.other_player.ai_controller.is_serving = false
|
98 |
+
|
99 |
+
for robot in players:
|
100 |
+
robot.ai_controller.steps_without_ball_hit_while_serving = 0
|
101 |
+
|
102 |
+
ball.reset(calc_ball_position(player))
|
103 |
+
|
104 |
+
|
105 |
+
func handle_victory(potential_winner: Robot):
|
106 |
+
if training_mode:
|
107 |
+
return
|
108 |
+
|
109 |
+
if check_if_game_winner(potential_winner):
|
110 |
+
if potential_winner.ai_controller.control_mode == AIController3D.ControlModes.HUMAN:
|
111 |
+
ui.show_winner_text("Player", 3)
|
112 |
+
else:
|
113 |
+
ui.show_winner_text(potential_winner.name, 3)
|
114 |
+
activate_game_reset()
|
115 |
+
|
116 |
+
|
117 |
+
func check_if_game_winner(robot: Robot):
|
118 |
+
if infinite_game:
|
119 |
+
return
|
120 |
+
|
121 |
+
if robot.score >= victory_at_score:
|
122 |
+
return true
|
123 |
+
return false
|
124 |
+
|
125 |
+
|
126 |
+
func activate_game_reset():
|
127 |
+
game_just_reset = true
|
scenes/game_scene/game_scene.tscn
ADDED
@@ -0,0 +1,377 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[gd_scene load_steps=36 format=3 uid="uid://2x5filmso32a"]
|
2 |
+
|
3 |
+
[ext_resource type="Script" path="res://scenes/game_scene/game_manager.gd" id="1_g4wvl"]
|
4 |
+
[ext_resource type="Script" path="res://scenes/game_scene/goal.gd" id="2_ypwf4"]
|
5 |
+
[ext_resource type="PackedScene" uid="uid://3gt386v3b1ej" path="res://scenes/robot/robot.tscn" id="3_y4pr4"]
|
6 |
+
[ext_resource type="Shader" uid="uid://der346ayua0mt" path="res://shaders/sway.tres" id="4_dl2k6"]
|
7 |
+
[ext_resource type="PackedScene" uid="uid://bfwxkao4uhtdy" path="res://blender/static_decorations.blend" id="5_5d1h1"]
|
8 |
+
[ext_resource type="Texture2D" uid="uid://7pxcpp75142j" path="res://blender/grass.png" id="5_kw2hd"]
|
9 |
+
[ext_resource type="Script" path="res://scenes/game_scene/ball.gd" id="5_xjnfp"]
|
10 |
+
[ext_resource type="Texture2D" uid="uid://cc7p54wl68umy" path="res://blender/grass2.png" id="6_oqveb"]
|
11 |
+
[ext_resource type="Texture2D" uid="uid://bqnr3brm7i4i7" path="res://blender/grass3.png" id="7_h2k6l"]
|
12 |
+
|
13 |
+
[sub_resource type="Gradient" id="Gradient_0rod8"]
|
14 |
+
colors = PackedColorArray(0.683594, 0.683594, 0.683594, 1, 1, 1, 1, 1)
|
15 |
+
|
16 |
+
[sub_resource type="FastNoiseLite" id="FastNoiseLite_kgiw2"]
|
17 |
+
frequency = 0.1
|
18 |
+
|
19 |
+
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_i1j55"]
|
20 |
+
color_ramp = SubResource("Gradient_0rod8")
|
21 |
+
noise = SubResource("FastNoiseLite_kgiw2")
|
22 |
+
|
23 |
+
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_si1yy"]
|
24 |
+
albedo_color = Color(0.729412, 0.670588, 0.0352941, 1)
|
25 |
+
albedo_texture = SubResource("NoiseTexture2D_i1j55")
|
26 |
+
|
27 |
+
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_v4edw"]
|
28 |
+
albedo_color = Color(1, 0.6, 0, 1)
|
29 |
+
|
30 |
+
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tsppj"]
|
31 |
+
transparency = 1
|
32 |
+
albedo_color = Color(0.0156863, 0.627451, 0.721569, 0.211765)
|
33 |
+
metallic = 0.85
|
34 |
+
roughness = 0.0
|
35 |
+
|
36 |
+
[sub_resource type="BoxShape3D" id="BoxShape3D_20bsr"]
|
37 |
+
size = Vector3(10, 10, 5)
|
38 |
+
|
39 |
+
[sub_resource type="BoxShape3D" id="BoxShape3D_nucsm"]
|
40 |
+
size = Vector3(10, 10, 5)
|
41 |
+
|
42 |
+
[sub_resource type="BoxShape3D" id="BoxShape3D_7q7xm"]
|
43 |
+
size = Vector3(30, 20, 15)
|
44 |
+
|
45 |
+
[sub_resource type="BoxShape3D" id="BoxShape3D_u865r"]
|
46 |
+
size = Vector3(0.2, 1.162, 2)
|
47 |
+
|
48 |
+
[sub_resource type="CylinderShape3D" id="CylinderShape3D_ho4bs"]
|
49 |
+
radius = 0.1
|
50 |
+
|
51 |
+
[sub_resource type="BoxShape3D" id="BoxShape3D_efmyo"]
|
52 |
+
size = Vector3(3, 1, 2)
|
53 |
+
|
54 |
+
[sub_resource type="Gradient" id="Gradient_epedm"]
|
55 |
+
colors = PackedColorArray(0.811765, 0.811765, 0.811765, 1, 1, 1, 1, 1)
|
56 |
+
|
57 |
+
[sub_resource type="FastNoiseLite" id="FastNoiseLite_quakn"]
|
58 |
+
fractal_octaves = 4
|
59 |
+
fractal_lacunarity = 7.155
|
60 |
+
fractal_gain = 0.415
|
61 |
+
fractal_weighted_strength = 0.5
|
62 |
+
|
63 |
+
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_vmvmy"]
|
64 |
+
width = 1280
|
65 |
+
height = 1280
|
66 |
+
color_ramp = SubResource("Gradient_epedm")
|
67 |
+
noise = SubResource("FastNoiseLite_quakn")
|
68 |
+
|
69 |
+
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_unsk7"]
|
70 |
+
albedo_color = Color(0, 0.517647, 0.0235294, 1)
|
71 |
+
albedo_texture = SubResource("NoiseTexture2D_vmvmy")
|
72 |
+
|
73 |
+
[sub_resource type="PlaneMesh" id="PlaneMesh_o0rtt"]
|
74 |
+
size = Vector2(20, 20)
|
75 |
+
|
76 |
+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ie7u0"]
|
77 |
+
resource_name = "grass"
|
78 |
+
render_priority = 0
|
79 |
+
shader = ExtResource("4_dl2k6")
|
80 |
+
shader_parameter/albedo = Color(1, 1, 1, 1)
|
81 |
+
shader_parameter/point_size = 1.0
|
82 |
+
shader_parameter/roughness = 0.5
|
83 |
+
shader_parameter/metallic_texture_channel = null
|
84 |
+
shader_parameter/specular = 0.5
|
85 |
+
shader_parameter/metallic = 0.0
|
86 |
+
shader_parameter/uv1_scale = Vector3(1, 1, 1)
|
87 |
+
shader_parameter/uv1_offset = Vector3(0, 0, 0)
|
88 |
+
shader_parameter/uv2_scale = Vector3(1, 1, 1)
|
89 |
+
shader_parameter/uv2_offset = Vector3(0, 0, 0)
|
90 |
+
shader_parameter/sway_frequency = 1.0
|
91 |
+
shader_parameter/sway_scale = 0.1
|
92 |
+
shader_parameter/texture_albedo = ExtResource("5_kw2hd")
|
93 |
+
|
94 |
+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pa0jt"]
|
95 |
+
resource_name = "grass2"
|
96 |
+
render_priority = 0
|
97 |
+
shader = ExtResource("4_dl2k6")
|
98 |
+
shader_parameter/albedo = Color(1, 1, 1, 1)
|
99 |
+
shader_parameter/point_size = 1.0
|
100 |
+
shader_parameter/roughness = 0.5
|
101 |
+
shader_parameter/metallic_texture_channel = null
|
102 |
+
shader_parameter/specular = 0.5
|
103 |
+
shader_parameter/metallic = 0.0
|
104 |
+
shader_parameter/uv1_scale = Vector3(1, 1, 1)
|
105 |
+
shader_parameter/uv1_offset = Vector3(0, 0, 0)
|
106 |
+
shader_parameter/uv2_scale = Vector3(1, 1, 1)
|
107 |
+
shader_parameter/uv2_offset = Vector3(0, 0, 0)
|
108 |
+
shader_parameter/sway_frequency = 1.0
|
109 |
+
shader_parameter/sway_scale = 0.1
|
110 |
+
shader_parameter/texture_albedo = ExtResource("6_oqveb")
|
111 |
+
|
112 |
+
[sub_resource type="ShaderMaterial" id="ShaderMaterial_og20f"]
|
113 |
+
resource_name = "grass3"
|
114 |
+
render_priority = 0
|
115 |
+
shader = ExtResource("4_dl2k6")
|
116 |
+
shader_parameter/albedo = Color(1, 1, 1, 1)
|
117 |
+
shader_parameter/point_size = 1.0
|
118 |
+
shader_parameter/roughness = 0.5
|
119 |
+
shader_parameter/metallic_texture_channel = null
|
120 |
+
shader_parameter/specular = 0.5
|
121 |
+
shader_parameter/metallic = 0.0
|
122 |
+
shader_parameter/uv1_scale = Vector3(1, 1, 1)
|
123 |
+
shader_parameter/uv1_offset = Vector3(0, 0, 0)
|
124 |
+
shader_parameter/uv2_scale = Vector3(1, 1, 1)
|
125 |
+
shader_parameter/uv2_offset = Vector3(0, 0, 0)
|
126 |
+
shader_parameter/sway_frequency = 1.0
|
127 |
+
shader_parameter/sway_scale = 0.1
|
128 |
+
shader_parameter/texture_albedo = ExtResource("7_h2k6l")
|
129 |
+
|
130 |
+
[sub_resource type="ArrayMesh" id="ArrayMesh_askja"]
|
131 |
+
_surfaces = [{
|
132 |
+
"aabb": AABB(-8.41681, -0.240389, -8.58835, 17.0486, 0.943132, 17.8912),
|
133 |
+
"format": 34896613377,
|
134 |
+
"index_count": 210,
|
135 |
+
"index_data": PackedByteArray(0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0, 4, 0, 7, 0, 5, 0, 4, 0, 6, 0, 7, 0, 8, 0, 11, 0, 9, 0, 8, 0, 10, 0, 11, 0, 12, 0, 15, 0, 13, 0, 12, 0, 14, 0, 15, 0, 16, 0, 19, 0, 17, 0, 16, 0, 18, 0, 19, 0, 20, 0, 23, 0, 21, 0, 20, 0, 22, 0, 23, 0, 24, 0, 27, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 31, 0, 29, 0, 28, 0, 30, 0, 31, 0, 32, 0, 35, 0, 33, 0, 32, 0, 34, 0, 35, 0, 36, 0, 39, 0, 37, 0, 36, 0, 38, 0, 39, 0, 40, 0, 43, 0, 41, 0, 40, 0, 42, 0, 43, 0, 44, 0, 47, 0, 45, 0, 44, 0, 46, 0, 47, 0, 48, 0, 51, 0, 49, 0, 48, 0, 50, 0, 51, 0, 52, 0, 55, 0, 53, 0, 52, 0, 54, 0, 55, 0, 56, 0, 59, 0, 57, 0, 56, 0, 58, 0, 59, 0, 60, 0, 63, 0, 61, 0, 60, 0, 62, 0, 63, 0, 64, 0, 67, 0, 65, 0, 64, 0, 66, 0, 67, 0, 68, 0, 71, 0, 69, 0, 68, 0, 70, 0, 71, 0, 72, 0, 75, 0, 73, 0, 72, 0, 74, 0, 75, 0, 76, 0, 79, 0, 77, 0, 76, 0, 78, 0, 79, 0, 80, 0, 83, 0, 81, 0, 80, 0, 82, 0, 83, 0, 84, 0, 87, 0, 85, 0, 84, 0, 86, 0, 87, 0, 88, 0, 91, 0, 89, 0, 88, 0, 90, 0, 91, 0, 92, 0, 95, 0, 93, 0, 92, 0, 94, 0, 95, 0, 96, 0, 99, 0, 97, 0, 96, 0, 98, 0, 99, 0, 100, 0, 103, 0, 101, 0, 100, 0, 102, 0, 103, 0, 104, 0, 107, 0, 105, 0, 104, 0, 106, 0, 107, 0, 108, 0, 111, 0, 109, 0, 108, 0, 110, 0, 111, 0, 112, 0, 115, 0, 113, 0, 112, 0, 114, 0, 115, 0, 116, 0, 119, 0, 117, 0, 116, 0, 118, 0, 119, 0, 120, 0, 123, 0, 121, 0, 120, 0, 122, 0, 123, 0, 124, 0, 127, 0, 125, 0, 124, 0, 126, 0, 127, 0, 128, 0, 131, 0, 129, 0, 128, 0, 130, 0, 131, 0, 132, 0, 135, 0, 133, 0, 132, 0, 134, 0, 135, 0, 136, 0, 139, 0, 137, 0, 136, 0, 138, 0, 139, 0),
|
136 |
+
"name": "grass",
|
137 |
+
"primitive": 3,
|
138 |
+
"uv_scale": Vector4(0, 0, 0, 0),
|
139 |
+
"vertex_count": 140,
|
140 |
+
"vertex_data": PackedByteArray(20, 7, 14, 63, 220, 44, 0, 0, 19, 14, 96, 38, 34, 65, 0, 0, 186, 7, 104, 222, 49, 45, 0, 0, 186, 14, 187, 197, 120, 65, 0, 0, 202, 15, 78, 54, 220, 104, 0, 0, 241, 18, 129, 33, 165, 126, 0, 0, 24, 16, 71, 227, 71, 105, 0, 0, 63, 19, 122, 206, 16, 127, 0, 0, 208, 39, 72, 13, 226, 99, 0, 0, 238, 38, 253, 29, 158, 119, 0, 0, 55, 40, 203, 230, 99, 99, 0, 0, 86, 39, 129, 247, 31, 119, 0, 0, 198, 27, 202, 4, 191, 100, 0, 0, 92, 22, 246, 37, 60, 123, 0, 0, 80, 27, 211, 222, 192, 99, 0, 0, 229, 21, 255, 255, 61, 122, 0, 0, 139, 8, 226, 16, 33, 90, 0, 0, 0, 0, 240, 18, 105, 109, 0, 0, 179, 8, 216, 241, 32, 90, 0, 0, 40, 0, 230, 243, 104, 109, 0, 0, 35, 248, 144, 34, 107, 82, 0, 0, 80, 240, 0, 37, 46, 102, 0, 0, 146, 248, 200, 223, 130, 82, 0, 0, 191, 240, 57, 226, 69, 102, 0, 0, 239, 203, 137, 20, 19, 0, 0, 0, 51, 200, 135, 25, 142, 20, 0, 0, 90, 204, 66, 235, 0, 0, 0, 0, 158, 200, 63, 240, 123, 20, 0, 0, 114, 230, 112, 30, 33, 45, 0, 0, 125, 238, 240, 19, 66, 66, 0, 0, 101, 231, 216, 240, 23, 45, 0, 0, 112, 239, 89, 230, 57, 66, 0, 0, 113, 189, 78, 57, 250, 75, 0, 0, 141, 198, 103, 35, 109, 95, 0, 0, 25, 190, 98, 225, 58, 76, 0, 0, 53, 199, 122, 203, 172, 95, 0, 0, 208, 207, 247, 34, 190, 82, 0, 0, 242, 207, 213, 32, 204, 103, 0, 0, 128, 207, 244, 227, 205, 82, 0, 0, 162, 207, 209, 225, 218, 103, 0, 0, 249, 91, 144, 34, 141, 182, 0, 0, 38, 84, 0, 37, 80, 202, 0, 0, 104, 92, 200, 223, 165, 182, 0, 0, 149, 84, 57, 226, 104, 202, 0, 0, 120, 54, 137, 20, 174, 142, 0, 0, 188, 50, 135, 25, 42, 163, 0, 0, 228, 54, 66, 235, 155, 142, 0, 0, 39, 51, 63, 240, 22, 163, 0, 0, 202, 75, 112, 30, 62, 164, 0, 0, 213, 83, 240, 19, 95, 185, 0, 0, 189, 76, 216, 240, 52, 164, 0, 0, 200, 84, 89, 230, 86, 185, 0, 0, 62, 41, 78, 57, 125, 179, 0, 0, 90, 50, 103, 35, 239, 198, 0, 0, 230, 41, 98, 225, 188, 179, 0, 0, 2, 51, 122, 203, 46, 199, 0, 0, 124, 57, 247, 34, 98, 182, 0, 0, 158, 57, 213, 32, 112, 203, 0, 0, 44, 57, 244, 227, 113, 182, 0, 0, 77, 57, 209, 225, 126, 203, 0, 0, 79, 38, 5, 33, 206, 58, 0, 0, 166, 37, 30, 42, 255, 79, 0, 0, 143, 37, 170, 218, 144, 58, 0, 0, 230, 36, 195, 227, 193, 79, 0, 0, 187, 18, 24, 40, 124, 86, 0, 0, 40, 17, 45, 49, 95, 107, 0, 0, 14, 19, 156, 211, 77, 86, 0, 0, 122, 17, 176, 220, 47, 107, 0, 0, 117, 95, 61, 37, 239, 35, 0, 0, 137, 88, 110, 8, 60, 56, 0, 0, 140, 94, 91, 252, 129, 36, 0, 0, 160, 87, 140, 223, 205, 56, 0, 0, 54, 44, 63, 48, 43, 72, 0, 0, 244, 54, 25, 57, 167, 93, 0, 0, 101, 44, 175, 203, 232, 71, 0, 0, 35, 55, 138, 212, 100, 93, 0, 0, 162, 66, 128, 65, 191, 38, 0, 0, 241, 74, 32, 34, 106, 59, 0, 0, 103, 66, 168, 226, 131, 39, 0, 0, 182, 74, 72, 195, 46, 60, 0, 0, 76, 243, 0, 0, 227, 125, 0, 0, 49, 239, 195, 2, 188, 147, 0, 0, 63, 244, 14, 218, 249, 125, 0, 0, 36, 240, 210, 220, 210, 147, 0, 0, 44, 230, 24, 8, 36, 135, 0, 0, 76, 231, 225, 3, 192, 156, 0, 0, 125, 230, 240, 216, 61, 135, 0, 0, 157, 231, 185, 212, 218, 156, 0, 0, 119, 243, 121, 20, 120, 102, 0, 0, 116, 241, 120, 18, 90, 124, 0, 0, 96, 244, 89, 202, 152, 102, 0, 0, 93, 242, 88, 200, 121, 124, 0, 0, 242, 210, 47, 10, 56, 115, 0, 0, 84, 211, 141, 6, 13, 139, 0, 0, 165, 211, 68, 214, 75, 115, 0, 0, 7, 212, 162, 210, 33, 139, 0, 0, 166, 234, 16, 11, 119, 133, 0, 0, 69, 232, 203, 12, 48, 155, 0, 0, 139, 235, 6, 208, 131, 133, 0, 0, 41, 233, 193, 209, 60, 155, 0, 0, 188, 216, 132, 29, 178, 184, 0, 0, 155, 206, 83, 65, 21, 205, 0, 0, 129, 216, 117, 195, 200, 183, 0, 0, 95, 206, 68, 231, 43, 204, 0, 0, 130, 202, 6, 30, 89, 228, 0, 0, 95, 206, 208, 39, 45, 249, 0, 0, 97, 202, 249, 220, 30, 228, 0, 0, 63, 206, 195, 230, 242, 248, 0, 0, 124, 253, 67, 41, 97, 235, 0, 0, 255, 255, 213, 54, 255, 255, 0, 0, 214, 252, 243, 205, 38, 235, 0, 0, 89, 255, 134, 219, 196, 255, 0, 0, 213, 243, 207, 25, 67, 147, 0, 0, 121, 241, 37, 37, 66, 167, 0, 0, 140, 244, 163, 223, 7, 147, 0, 0, 49, 242, 249, 234, 6, 167, 0, 0, 66, 232, 182, 35, 187, 200, 0, 0, 234, 241, 152, 36, 202, 221, 0, 0, 131, 231, 48, 224, 5, 201, 0, 0, 43, 241, 19, 225, 20, 222, 0, 0, 105, 51, 132, 29, 236, 174, 0, 0, 71, 41, 83, 65, 80, 195, 0, 0, 45, 51, 117, 195, 2, 174, 0, 0, 12, 41, 68, 231, 101, 194, 0, 0, 46, 37, 6, 30, 147, 218, 0, 0, 12, 41, 208, 39, 103, 239, 0, 0, 14, 37, 249, 220, 89, 218, 0, 0, 235, 40, 195, 230, 45, 239, 0, 0, 41, 88, 67, 41, 156, 225, 0, 0, 171, 90, 213, 54, 57, 246, 0, 0, 131, 87, 243, 205, 97, 225, 0, 0, 5, 90, 134, 219, 254, 245, 0, 0, 129, 78, 207, 25, 125, 137, 0, 0, 38, 76, 37, 37, 124, 157, 0, 0, 57, 79, 163, 223, 65, 137, 0, 0, 222, 76, 249, 234, 64, 157, 0, 0, 238, 66, 182, 35, 246, 190, 0, 0, 151, 76, 152, 36, 5, 212, 0, 0, 47, 66, 48, 224, 64, 191, 0, 0, 216, 75, 19, 225, 79, 212, 0, 0)
|
141 |
+
}, {
|
142 |
+
"aabb": AABB(-8.36209, -0.222683, -9.15225, 16.4609, 0.919043, 18.7848),
|
143 |
+
"format": 34896613377,
|
144 |
+
"index_count": 210,
|
145 |
+
"index_data": PackedByteArray(0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0, 4, 0, 7, 0, 5, 0, 4, 0, 6, 0, 7, 0, 8, 0, 11, 0, 9, 0, 8, 0, 10, 0, 11, 0, 12, 0, 15, 0, 13, 0, 12, 0, 14, 0, 15, 0, 16, 0, 19, 0, 17, 0, 16, 0, 18, 0, 19, 0, 20, 0, 23, 0, 21, 0, 20, 0, 22, 0, 23, 0, 24, 0, 27, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 31, 0, 29, 0, 28, 0, 30, 0, 31, 0, 32, 0, 35, 0, 33, 0, 32, 0, 34, 0, 35, 0, 36, 0, 39, 0, 37, 0, 36, 0, 38, 0, 39, 0, 40, 0, 43, 0, 41, 0, 40, 0, 42, 0, 43, 0, 44, 0, 47, 0, 45, 0, 44, 0, 46, 0, 47, 0, 48, 0, 51, 0, 49, 0, 48, 0, 50, 0, 51, 0, 52, 0, 55, 0, 53, 0, 52, 0, 54, 0, 55, 0, 56, 0, 59, 0, 57, 0, 56, 0, 58, 0, 59, 0, 60, 0, 63, 0, 61, 0, 60, 0, 62, 0, 63, 0, 64, 0, 67, 0, 65, 0, 64, 0, 66, 0, 67, 0, 68, 0, 71, 0, 69, 0, 68, 0, 70, 0, 71, 0, 72, 0, 75, 0, 73, 0, 72, 0, 74, 0, 75, 0, 76, 0, 79, 0, 77, 0, 76, 0, 78, 0, 79, 0, 80, 0, 83, 0, 81, 0, 80, 0, 82, 0, 83, 0, 84, 0, 87, 0, 85, 0, 84, 0, 86, 0, 87, 0, 88, 0, 91, 0, 89, 0, 88, 0, 90, 0, 91, 0, 92, 0, 95, 0, 93, 0, 92, 0, 94, 0, 95, 0, 96, 0, 99, 0, 97, 0, 96, 0, 98, 0, 99, 0, 100, 0, 103, 0, 101, 0, 100, 0, 102, 0, 103, 0, 104, 0, 107, 0, 105, 0, 104, 0, 106, 0, 107, 0, 108, 0, 111, 0, 109, 0, 108, 0, 110, 0, 111, 0, 112, 0, 115, 0, 113, 0, 112, 0, 114, 0, 115, 0, 116, 0, 119, 0, 117, 0, 116, 0, 118, 0, 119, 0, 120, 0, 123, 0, 121, 0, 120, 0, 122, 0, 123, 0, 124, 0, 127, 0, 125, 0, 124, 0, 126, 0, 127, 0, 128, 0, 131, 0, 129, 0, 128, 0, 130, 0, 131, 0, 132, 0, 135, 0, 133, 0, 132, 0, 134, 0, 135, 0, 136, 0, 139, 0, 137, 0, 136, 0, 138, 0, 139, 0),
|
146 |
+
"name": "grass2",
|
147 |
+
"primitive": 3,
|
148 |
+
"uv_scale": Vector4(0, 0, 0, 0),
|
149 |
+
"vertex_count": 140,
|
150 |
+
"vertex_data": PackedByteArray(115, 71, 218, 24, 55, 131, 0, 0, 215, 78, 214, 60, 164, 150, 0, 0, 60, 71, 235, 196, 131, 130, 0, 0, 160, 78, 231, 232, 241, 149, 0, 0, 73, 67, 14, 22, 105, 60, 0, 0, 176, 56, 92, 24, 225, 80, 0, 0, 224, 66, 101, 233, 49, 60, 0, 0, 71, 56, 179, 235, 168, 80, 0, 0, 64, 61, 133, 37, 117, 9, 0, 0, 251, 67, 225, 42, 189, 29, 0, 0, 155, 60, 224, 214, 130, 9, 0, 0, 86, 67, 60, 220, 202, 29, 0, 0, 12, 96, 9, 39, 14, 0, 0, 0, 27, 104, 129, 47, 252, 17, 0, 0, 167, 95, 64, 210, 0, 0, 0, 0, 182, 103, 184, 218, 238, 17, 0, 0, 47, 103, 137, 31, 75, 10, 0, 0, 233, 109, 180, 34, 238, 28, 0, 0, 75, 103, 13, 223, 48, 10, 0, 0, 5, 110, 56, 226, 210, 28, 0, 0, 75, 255, 98, 24, 152, 2, 0, 0, 223, 254, 129, 26, 114, 24, 0, 0, 255, 255, 64, 231, 142, 2, 0, 0, 146, 255, 95, 233, 104, 24, 0, 0, 123, 217, 246, 34, 195, 43, 0, 0, 151, 220, 113, 66, 240, 65, 0, 0, 194, 217, 80, 191, 52, 43, 0, 0, 221, 220, 203, 222, 96, 65, 0, 0, 127, 194, 227, 56, 189, 35, 0, 0, 28, 200, 72, 44, 241, 57, 0, 0, 172, 194, 121, 213, 235, 35, 0, 0, 73, 200, 222, 200, 31, 58, 0, 0, 172, 178, 255, 5, 95, 100, 0, 0, 147, 176, 88, 21, 50, 120, 0, 0, 151, 179, 105, 236, 5, 100, 0, 0, 125, 177, 194, 251, 216, 119, 0, 0, 165, 168, 6, 5, 122, 31, 0, 0, 66, 164, 218, 30, 36, 51, 0, 0, 183, 169, 231, 226, 246, 30, 0, 0, 85, 165, 187, 252, 160, 50, 0, 0, 15, 93, 98, 24, 121, 140, 0, 0, 163, 92, 129, 26, 83, 162, 0, 0, 194, 93, 64, 231, 111, 140, 0, 0, 86, 93, 95, 233, 73, 162, 0, 0, 2, 61, 246, 34, 99, 160, 0, 0, 30, 64, 113, 66, 144, 182, 0, 0, 73, 61, 80, 191, 211, 159, 0, 0, 100, 64, 203, 222, 0, 182, 0, 0, 124, 41, 227, 56, 81, 156, 0, 0, 25, 47, 72, 44, 133, 178, 0, 0, 169, 41, 121, 213, 127, 156, 0, 0, 70, 47, 222, 200, 179, 178, 0, 0, 187, 28, 255, 5, 65, 188, 0, 0, 161, 26, 88, 21, 20, 208, 0, 0, 166, 29, 105, 236, 231, 187, 0, 0, 140, 27, 194, 251, 186, 207, 0, 0, 119, 20, 6, 5, 24, 155, 0, 0, 20, 16, 218, 30, 194, 174, 0, 0, 138, 21, 231, 226, 149, 154, 0, 0, 39, 17, 187, 252, 63, 174, 0, 0, 69, 99, 89, 8, 63, 45, 0, 0, 220, 89, 129, 27, 130, 64, 0, 0, 77, 100, 64, 230, 27, 45, 0, 0, 228, 90, 104, 249, 94, 64, 0, 0, 136, 60, 229, 16, 33, 72, 0, 0, 11, 51, 16, 34, 89, 92, 0, 0, 200, 60, 177, 223, 205, 71, 0, 0, 76, 51, 220, 240, 5, 92, 0, 0, 50, 66, 106, 13, 150, 49, 0, 0, 77, 68, 184, 37, 47, 69, 0, 0, 235, 66, 9, 220, 234, 48, 0, 0, 6, 69, 87, 244, 130, 68, 0, 0, 178, 33, 149, 11, 251, 76, 0, 0, 203, 31, 201, 21, 58, 96, 0, 0, 35, 34, 248, 235, 186, 76, 0, 0, 59, 32, 44, 246, 249, 95, 0, 0, 58, 98, 240, 18, 167, 77, 0, 0, 96, 90, 95, 30, 0, 96, 0, 0, 167, 98, 98, 227, 124, 77, 0, 0, 206, 90, 209, 238, 212, 95, 0, 0, 72, 242, 0, 0, 57, 111, 0, 0, 56, 245, 115, 2, 202, 129, 0, 0, 154, 240, 75, 214, 92, 111, 0, 0, 138, 243, 190, 216, 237, 129, 0, 0, 133, 191, 39, 11, 239, 105, 0, 0, 129, 193, 226, 10, 187, 125, 0, 0, 246, 192, 219, 205, 212, 105, 0, 0, 242, 194, 151, 205, 160, 125, 0, 0, 172, 240, 4, 26, 48, 128, 0, 0, 11, 236, 146, 26, 31, 149, 0, 0, 90, 239, 44, 190, 244, 127, 0, 0, 186, 234, 186, 190, 227, 148, 0, 0, 131, 189, 179, 19, 171, 130, 0, 0, 130, 193, 123, 18, 243, 152, 0, 0, 246, 187, 66, 198, 232, 130, 0, 0, 245, 191, 11, 197, 47, 153, 0, 0, 33, 200, 203, 14, 32, 113, 0, 0, 44, 204, 5, 12, 75, 134, 0, 0, 220, 198, 185, 204, 95, 113, 0, 0, 231, 202, 243, 201, 138, 134, 0, 0, 101, 191, 88, 29, 161, 162, 0, 0, 188, 192, 195, 1, 47, 184, 0, 0, 39, 192, 255, 255, 73, 163, 0, 0, 126, 193, 105, 228, 216, 184, 0, 0, 40, 175, 223, 4, 200, 198, 0, 0, 58, 171, 246, 21, 147, 220, 0, 0, 36, 176, 203, 235, 124, 198, 0, 0, 54, 172, 226, 252, 71, 220, 0, 0, 97, 183, 124, 32, 76, 235, 0, 0, 251, 186, 249, 56, 255, 255, 0, 0, 246, 183, 200, 200, 190, 234, 0, 0, 144, 187, 69, 225, 113, 255, 0, 0, 204, 187, 230, 55, 170, 204, 0, 0, 133, 185, 3, 45, 233, 223, 0, 0, 43, 187, 190, 212, 210, 204, 0, 0, 228, 184, 219, 201, 16, 224, 0, 0, 22, 238, 125, 37, 95, 186, 0, 0, 160, 245, 201, 43, 132, 204, 0, 0, 227, 237, 248, 213, 74, 186, 0, 0, 109, 245, 69, 220, 111, 204, 0, 0, 43, 20, 88, 29, 82, 153, 0, 0, 129, 21, 195, 1, 225, 174, 0, 0, 237, 20, 254, 255, 250, 153, 0, 0, 68, 22, 105, 228, 137, 175, 0, 0, 237, 3, 223, 4, 121, 189, 0, 0, 0, 0, 246, 21, 68, 211, 0, 0, 233, 4, 203, 235, 45, 189, 0, 0, 252, 0, 226, 252, 248, 210, 0, 0, 39, 12, 124, 32, 254, 225, 0, 0, 193, 15, 249, 56, 176, 246, 0, 0, 188, 12, 200, 200, 112, 225, 0, 0, 86, 16, 69, 225, 34, 246, 0, 0, 145, 16, 230, 55, 92, 195, 0, 0, 74, 14, 3, 45, 154, 214, 0, 0, 241, 15, 190, 212, 131, 195, 0, 0, 170, 13, 219, 201, 194, 214, 0, 0, 219, 66, 124, 37, 17, 177, 0, 0, 102, 74, 201, 43, 54, 195, 0, 0, 168, 66, 248, 213, 251, 176, 0, 0, 51, 74, 69, 220, 32, 195, 0, 0)
|
151 |
+
}, {
|
152 |
+
"aabb": AABB(-8.38425, -0.244321, -8.59889, 16.6521, 0.950857, 18.4937),
|
153 |
+
"format": 34896613377,
|
154 |
+
"index_count": 204,
|
155 |
+
"index_data": PackedByteArray(0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0, 4, 0, 7, 0, 5, 0, 4, 0, 6, 0, 7, 0, 8, 0, 11, 0, 9, 0, 8, 0, 10, 0, 11, 0, 12, 0, 15, 0, 13, 0, 12, 0, 14, 0, 15, 0, 16, 0, 19, 0, 17, 0, 16, 0, 18, 0, 19, 0, 20, 0, 23, 0, 21, 0, 20, 0, 22, 0, 23, 0, 24, 0, 27, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 31, 0, 29, 0, 28, 0, 30, 0, 31, 0, 32, 0, 35, 0, 33, 0, 32, 0, 34, 0, 35, 0, 36, 0, 39, 0, 37, 0, 36, 0, 38, 0, 39, 0, 40, 0, 43, 0, 41, 0, 40, 0, 42, 0, 43, 0, 44, 0, 47, 0, 45, 0, 44, 0, 46, 0, 47, 0, 48, 0, 51, 0, 49, 0, 48, 0, 50, 0, 51, 0, 52, 0, 55, 0, 53, 0, 52, 0, 54, 0, 55, 0, 56, 0, 59, 0, 57, 0, 56, 0, 58, 0, 59, 0, 60, 0, 63, 0, 61, 0, 60, 0, 62, 0, 63, 0, 64, 0, 67, 0, 65, 0, 64, 0, 66, 0, 67, 0, 68, 0, 71, 0, 69, 0, 68, 0, 70, 0, 71, 0, 72, 0, 75, 0, 73, 0, 72, 0, 74, 0, 75, 0, 76, 0, 79, 0, 77, 0, 76, 0, 78, 0, 79, 0, 80, 0, 83, 0, 81, 0, 80, 0, 82, 0, 83, 0, 84, 0, 87, 0, 85, 0, 84, 0, 86, 0, 87, 0, 88, 0, 91, 0, 89, 0, 88, 0, 90, 0, 91, 0, 92, 0, 95, 0, 93, 0, 92, 0, 94, 0, 95, 0, 96, 0, 99, 0, 97, 0, 96, 0, 98, 0, 99, 0, 100, 0, 103, 0, 101, 0, 100, 0, 102, 0, 103, 0, 104, 0, 107, 0, 105, 0, 104, 0, 106, 0, 107, 0, 108, 0, 111, 0, 109, 0, 108, 0, 110, 0, 111, 0, 112, 0, 115, 0, 113, 0, 112, 0, 114, 0, 115, 0, 116, 0, 119, 0, 117, 0, 116, 0, 118, 0, 119, 0, 120, 0, 123, 0, 121, 0, 120, 0, 122, 0, 123, 0, 124, 0, 127, 0, 125, 0, 124, 0, 126, 0, 127, 0, 128, 0, 131, 0, 129, 0, 128, 0, 130, 0, 131, 0, 132, 0, 135, 0, 133, 0, 132, 0, 134, 0, 135, 0),
|
156 |
+
"name": "grass3",
|
157 |
+
"primitive": 3,
|
158 |
+
"uv_scale": Vector4(0, 0, 0, 0),
|
159 |
+
"vertex_count": 136,
|
160 |
+
"vertex_data": PackedByteArray(51, 101, 23, 48, 255, 50, 0, 0, 255, 98, 49, 47, 215, 70, 0, 0, 123, 101, 151, 213, 11, 51, 0, 0, 71, 99, 177, 212, 226, 70, 0, 0, 187, 11, 28, 30, 151, 4, 0, 0, 218, 1, 76, 44, 37, 25, 0, 0, 71, 12, 123, 216, 119, 4, 0, 0, 102, 2, 172, 230, 5, 25, 0, 0, 141, 9, 185, 52, 51, 15, 0, 0, 90, 0, 154, 46, 233, 34, 0, 0, 230, 9, 46, 214, 118, 15, 0, 0, 178, 0, 15, 208, 45, 35, 0, 0, 15, 70, 195, 46, 197, 10, 0, 0, 7, 68, 205, 52, 135, 32, 0, 0, 119, 70, 250, 207, 174, 10, 0, 0, 111, 68, 4, 214, 113, 32, 0, 0, 224, 179, 73, 31, 253, 73, 0, 0, 48, 177, 118, 26, 188, 96, 0, 0, 199, 179, 82, 234, 24, 74, 0, 0, 22, 177, 126, 229, 215, 96, 0, 0, 241, 199, 196, 31, 54, 39, 0, 0, 148, 195, 174, 38, 52, 59, 0, 0, 63, 200, 26, 222, 23, 39, 0, 0, 225, 195, 4, 229, 21, 59, 0, 0, 122, 245, 123, 48, 0, 0, 0, 0, 52, 255, 179, 55, 20, 21, 0, 0, 250, 244, 21, 205, 11, 0, 0, 0, 179, 254, 76, 212, 32, 21, 0, 0, 212, 230, 119, 68, 24, 34, 0, 0, 152, 230, 74, 37, 9, 54, 0, 0, 216, 230, 126, 223, 188, 34, 0, 0, 156, 230, 81, 192, 173, 54, 0, 0, 255, 255, 247, 51, 140, 59, 0, 0, 202, 253, 166, 47, 62, 82, 0, 0, 234, 255, 34, 213, 159, 59, 0, 0, 181, 253, 209, 208, 81, 82, 0, 0, 82, 31, 73, 31, 248, 172, 0, 0, 161, 28, 118, 26, 182, 195, 0, 0, 57, 31, 82, 234, 18, 173, 0, 0, 136, 28, 126, 229, 209, 195, 0, 0, 76, 48, 196, 31, 245, 156, 0, 0, 239, 43, 174, 38, 243, 176, 0, 0, 154, 48, 26, 222, 214, 156, 0, 0, 61, 44, 4, 229, 212, 176, 0, 0, 139, 85, 123, 48, 183, 137, 0, 0, 68, 95, 179, 55, 203, 158, 0, 0, 10, 85, 21, 205, 194, 137, 0, 0, 196, 94, 76, 212, 215, 158, 0, 0, 248, 73, 119, 68, 78, 154, 0, 0, 188, 73, 74, 37, 63, 174, 0, 0, 252, 73, 126, 223, 242, 154, 0, 0, 192, 73, 81, 192, 227, 174, 0, 0, 77, 95, 247, 51, 5, 166, 0, 0, 24, 93, 166, 47, 183, 188, 0, 0, 56, 95, 34, 213, 24, 166, 0, 0, 3, 93, 209, 208, 202, 188, 0, 0, 117, 86, 218, 36, 147, 72, 0, 0, 86, 92, 201, 4, 208, 91, 0, 0, 93, 87, 255, 255, 80, 73, 0, 0, 63, 93, 238, 223, 142, 92, 0, 0, 237, 51, 91, 19, 49, 83, 0, 0, 241, 60, 64, 52, 118, 101, 0, 0, 79, 51, 136, 208, 138, 82, 0, 0, 83, 60, 109, 241, 207, 100, 0, 0, 120, 63, 204, 50, 60, 52, 0, 0, 80, 53, 203, 44, 125, 71, 0, 0, 119, 63, 252, 215, 94, 52, 0, 0, 78, 53, 252, 209, 159, 71, 0, 0, 86, 31, 242, 33, 205, 43, 0, 0, 18, 32, 111, 63, 74, 66, 0, 0, 151, 30, 89, 197, 65, 43, 0, 0, 83, 31, 214, 226, 190, 65, 0, 0, 146, 67, 88, 39, 156, 57, 0, 0, 224, 65, 218, 44, 155, 76, 0, 0, 200, 66, 238, 215, 107, 57, 0, 0, 22, 65, 112, 221, 105, 76, 0, 0, 0, 184, 63, 28, 89, 119, 0, 0, 38, 186, 22, 26, 241, 139, 0, 0, 183, 183, 14, 195, 107, 119, 0, 0, 221, 185, 229, 192, 3, 140, 0, 0, 203, 203, 0, 0, 136, 130, 0, 0, 250, 206, 244, 3, 57, 152, 0, 0, 132, 205, 48, 217, 57, 130, 0, 0, 179, 208, 36, 221, 234, 151, 0, 0, 86, 216, 235, 15, 48, 115, 0, 0, 189, 217, 50, 15, 175, 135, 0, 0, 237, 215, 242, 205, 58, 115, 0, 0, 83, 217, 57, 205, 186, 135, 0, 0, 34, 200, 140, 16, 53, 115, 0, 0, 75, 201, 48, 13, 205, 134, 0, 0, 102, 198, 243, 207, 96, 115, 0, 0, 143, 199, 152, 204, 248, 134, 0, 0, 186, 245, 97, 23, 82, 141, 0, 0, 56, 243, 240, 24, 19, 162, 0, 0, 34, 244, 52, 196, 33, 141, 0, 0, 160, 241, 194, 197, 226, 161, 0, 0, 67, 169, 54, 51, 223, 236, 0, 0, 202, 174, 79, 45, 255, 255, 0, 0, 246, 169, 121, 215, 215, 236, 0, 0, 125, 175, 146, 209, 247, 255, 0, 0, 148, 200, 103, 58, 229, 154, 0, 0, 48, 199, 230, 48, 200, 174, 0, 0, 217, 200, 226, 211, 26, 155, 0, 0, 117, 199, 97, 202, 254, 174, 0, 0, 84, 218, 121, 26, 217, 173, 0, 0, 32, 213, 97, 59, 114, 194, 0, 0, 124, 218, 102, 201, 36, 173, 0, 0, 71, 213, 79, 234, 189, 193, 0, 0, 137, 230, 90, 23, 218, 193, 0, 0, 59, 241, 28, 39, 212, 214, 0, 0, 15, 231, 172, 221, 62, 193, 0, 0, 193, 241, 110, 237, 56, 214, 0, 0, 37, 200, 173, 10, 199, 184, 0, 0, 236, 207, 92, 31, 5, 206, 0, 0, 233, 200, 108, 229, 252, 183, 0, 0, 176, 208, 27, 250, 59, 205, 0, 0, 0, 0, 54, 51, 106, 227, 0, 0, 135, 5, 79, 45, 138, 246, 0, 0, 178, 0, 121, 215, 99, 227, 0, 0, 57, 6, 146, 209, 131, 246, 0, 0, 80, 31, 103, 58, 112, 145, 0, 0, 237, 29, 230, 48, 84, 165, 0, 0, 149, 31, 226, 211, 166, 145, 0, 0, 50, 30, 97, 202, 138, 165, 0, 0, 17, 49, 121, 26, 101, 164, 0, 0, 220, 43, 97, 59, 253, 184, 0, 0, 56, 49, 102, 201, 176, 163, 0, 0, 4, 44, 79, 234, 72, 184, 0, 0, 69, 61, 90, 23, 102, 184, 0, 0, 248, 71, 28, 39, 96, 205, 0, 0, 203, 61, 172, 221, 202, 183, 0, 0, 126, 72, 110, 237, 196, 204, 0, 0, 226, 30, 173, 10, 82, 175, 0, 0, 169, 38, 92, 31, 145, 196, 0, 0, 165, 31, 108, 229, 136, 174, 0, 0, 108, 39, 27, 250, 199, 195, 0, 0)
|
161 |
+
}]
|
162 |
+
blend_shape_mode = 0
|
163 |
+
|
164 |
+
[sub_resource type="ArrayMesh" id="ArrayMesh_1dxiy"]
|
165 |
+
resource_name = "static_decorations_Plane_093"
|
166 |
+
_surfaces = [{
|
167 |
+
"aabb": AABB(-8.41681, -0.240389, -8.58835, 17.0486, 0.943132, 17.8912),
|
168 |
+
"attribute_data": PackedByteArray(0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0),
|
169 |
+
"format": 34896613399,
|
170 |
+
"index_count": 210,
|
171 |
+
"index_data": PackedByteArray(0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0, 4, 0, 7, 0, 5, 0, 4, 0, 6, 0, 7, 0, 8, 0, 11, 0, 9, 0, 8, 0, 10, 0, 11, 0, 12, 0, 15, 0, 13, 0, 12, 0, 14, 0, 15, 0, 16, 0, 19, 0, 17, 0, 16, 0, 18, 0, 19, 0, 20, 0, 23, 0, 21, 0, 20, 0, 22, 0, 23, 0, 24, 0, 27, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 31, 0, 29, 0, 28, 0, 30, 0, 31, 0, 32, 0, 35, 0, 33, 0, 32, 0, 34, 0, 35, 0, 36, 0, 39, 0, 37, 0, 36, 0, 38, 0, 39, 0, 40, 0, 43, 0, 41, 0, 40, 0, 42, 0, 43, 0, 44, 0, 47, 0, 45, 0, 44, 0, 46, 0, 47, 0, 48, 0, 51, 0, 49, 0, 48, 0, 50, 0, 51, 0, 52, 0, 55, 0, 53, 0, 52, 0, 54, 0, 55, 0, 56, 0, 59, 0, 57, 0, 56, 0, 58, 0, 59, 0, 60, 0, 63, 0, 61, 0, 60, 0, 62, 0, 63, 0, 64, 0, 67, 0, 65, 0, 64, 0, 66, 0, 67, 0, 68, 0, 71, 0, 69, 0, 68, 0, 70, 0, 71, 0, 72, 0, 75, 0, 73, 0, 72, 0, 74, 0, 75, 0, 76, 0, 79, 0, 77, 0, 76, 0, 78, 0, 79, 0, 80, 0, 83, 0, 81, 0, 80, 0, 82, 0, 83, 0, 84, 0, 87, 0, 85, 0, 84, 0, 86, 0, 87, 0, 88, 0, 91, 0, 89, 0, 88, 0, 90, 0, 91, 0, 92, 0, 95, 0, 93, 0, 92, 0, 94, 0, 95, 0, 96, 0, 99, 0, 97, 0, 96, 0, 98, 0, 99, 0, 100, 0, 103, 0, 101, 0, 100, 0, 102, 0, 103, 0, 104, 0, 107, 0, 105, 0, 104, 0, 106, 0, 107, 0, 108, 0, 111, 0, 109, 0, 108, 0, 110, 0, 111, 0, 112, 0, 115, 0, 113, 0, 112, 0, 114, 0, 115, 0, 116, 0, 119, 0, 117, 0, 116, 0, 118, 0, 119, 0, 120, 0, 123, 0, 121, 0, 120, 0, 122, 0, 123, 0, 124, 0, 127, 0, 125, 0, 124, 0, 126, 0, 127, 0, 128, 0, 131, 0, 129, 0, 128, 0, 130, 0, 131, 0, 132, 0, 135, 0, 133, 0, 132, 0, 134, 0, 135, 0, 136, 0, 139, 0, 137, 0, 136, 0, 138, 0, 139, 0),
|
172 |
+
"material": SubResource("ShaderMaterial_ie7u0"),
|
173 |
+
"name": "grass",
|
174 |
+
"primitive": 3,
|
175 |
+
"uv_scale": Vector4(0, 0, 0, 0),
|
176 |
+
"vertex_count": 140,
|
177 |
+
"vertex_data": PackedByteArray(20, 7, 14, 63, 220, 44, 19, 179, 19, 14, 96, 38, 34, 65, 19, 179, 186, 7, 104, 222, 49, 45, 19, 179, 186, 14, 187, 197, 120, 65, 19, 179, 202, 15, 78, 54, 220, 104, 108, 186, 241, 18, 129, 33, 165, 126, 108, 186, 24, 16, 71, 227, 71, 105, 108, 186, 63, 19, 122, 206, 16, 127, 108, 186, 208, 39, 72, 13, 226, 99, 201, 193, 238, 38, 253, 29, 158, 119, 201, 193, 55, 40, 203, 230, 99, 99, 201, 193, 86, 39, 129, 247, 31, 119, 201, 193, 198, 27, 202, 4, 191, 100, 44, 201, 92, 22, 246, 37, 60, 123, 44, 201, 80, 27, 211, 222, 192, 99, 44, 201, 229, 21, 255, 255, 61, 122, 44, 201, 139, 8, 226, 16, 33, 90, 71, 208, 0, 0, 240, 18, 105, 109, 71, 208, 179, 8, 216, 241, 32, 90, 71, 208, 40, 0, 230, 243, 104, 109, 71, 208, 35, 248, 144, 34, 107, 82, 182, 206, 80, 240, 0, 37, 46, 102, 182, 206, 146, 248, 200, 223, 130, 82, 182, 206, 191, 240, 57, 226, 69, 102, 182, 206, 239, 203, 137, 20, 19, 0, 7, 199, 51, 200, 135, 25, 142, 20, 7, 199, 90, 204, 66, 235, 0, 0, 7, 199, 158, 200, 63, 240, 123, 20, 7, 199, 114, 230, 112, 30, 33, 45, 224, 177, 125, 238, 240, 19, 66, 66, 224, 177, 101, 231, 216, 240, 23, 45, 224, 177, 112, 239, 89, 230, 57, 66, 224, 177, 113, 189, 78, 57, 250, 75, 236, 174, 141, 198, 103, 35, 109, 95, 236, 174, 25, 190, 98, 225, 58, 76, 236, 174, 53, 199, 122, 203, 172, 95, 236, 174, 208, 207, 247, 34, 190, 82, 196, 191, 242, 207, 213, 32, 204, 103, 196, 191, 128, 207, 244, 227, 205, 82, 196, 191, 162, 207, 209, 225, 218, 103, 196, 191, 249, 91, 144, 34, 141, 182, 182, 206, 38, 84, 0, 37, 80, 202, 182, 206, 104, 92, 200, 223, 165, 182, 182, 206, 149, 84, 57, 226, 104, 202, 182, 206, 120, 54, 137, 20, 174, 142, 7, 199, 188, 50, 135, 25, 42, 163, 7, 199, 228, 54, 66, 235, 155, 142, 7, 199, 39, 51, 63, 240, 22, 163, 7, 199, 202, 75, 112, 30, 62, 164, 224, 177, 213, 83, 240, 19, 95, 185, 224, 177, 189, 76, 216, 240, 52, 164, 224, 177, 200, 84, 89, 230, 86, 185, 224, 177, 62, 41, 78, 57, 125, 179, 236, 174, 90, 50, 103, 35, 239, 198, 236, 174, 230, 41, 98, 225, 188, 179, 236, 174, 2, 51, 122, 203, 46, 199, 236, 174, 124, 57, 247, 34, 98, 182, 196, 191, 158, 57, 213, 32, 112, 203, 196, 191, 44, 57, 244, 227, 113, 182, 196, 191, 77, 57, 209, 225, 126, 203, 196, 191, 79, 38, 5, 33, 206, 58, 59, 193, 166, 37, 30, 42, 255, 79, 59, 193, 143, 37, 170, 218, 144, 58, 59, 193, 230, 36, 195, 227, 193, 79, 59, 193, 187, 18, 24, 40, 124, 86, 244, 194, 40, 17, 45, 49, 95, 107, 244, 194, 14, 19, 156, 211, 77, 86, 244, 194, 122, 17, 176, 220, 47, 107, 244, 194, 117, 95, 61, 37, 239, 35, 240, 204, 137, 88, 110, 8, 60, 56, 240, 204, 140, 94, 91, 252, 129, 36, 240, 204, 160, 87, 140, 223, 205, 56, 240, 204, 54, 44, 63, 48, 43, 72, 234, 173, 244, 54, 25, 57, 167, 93, 234, 173, 101, 44, 175, 203, 232, 71, 234, 173, 35, 55, 138, 212, 100, 93, 234, 173, 162, 66, 128, 65, 191, 38, 79, 177, 241, 74, 32, 34, 106, 59, 79, 177, 103, 66, 168, 226, 131, 39, 79, 177, 182, 74, 72, 195, 46, 60, 79, 177, 76, 243, 0, 0, 227, 125, 71, 199, 49, 239, 195, 2, 188, 147, 71, 199, 63, 244, 14, 218, 249, 125, 71, 199, 36, 240, 210, 220, 210, 147, 71, 199, 44, 230, 24, 8, 36, 135, 249, 189, 76, 231, 225, 3, 192, 156, 249, 189, 125, 230, 240, 216, 61, 135, 249, 189, 157, 231, 185, 212, 218, 156, 249, 189, 119, 243, 121, 20, 120, 102, 160, 195, 116, 241, 120, 18, 90, 124, 160, 195, 96, 244, 89, 202, 152, 102, 160, 195, 93, 242, 88, 200, 121, 124, 160, 195, 242, 210, 47, 10, 56, 115, 103, 191, 84, 211, 141, 6, 13, 139, 103, 191, 165, 211, 68, 214, 75, 115, 103, 191, 7, 212, 162, 210, 33, 139, 103, 191, 166, 234, 16, 11, 119, 133, 78, 196, 69, 232, 203, 12, 48, 155, 78, 196, 139, 235, 6, 208, 131, 133, 78, 196, 41, 233, 193, 209, 60, 155, 78, 196, 188, 216, 132, 29, 178, 184, 249, 209, 155, 206, 83, 65, 21, 205, 249, 209, 129, 216, 117, 195, 200, 183, 249, 209, 95, 206, 68, 231, 43, 204, 249, 209, 130, 202, 6, 30, 89, 228, 222, 184, 95, 206, 208, 39, 45, 249, 222, 184, 97, 202, 249, 220, 30, 228, 222, 184, 63, 206, 195, 230, 242, 248, 222, 184, 124, 253, 67, 41, 97, 235, 79, 187, 255, 255, 213, 54, 255, 255, 79, 187, 214, 252, 243, 205, 38, 235, 79, 187, 89, 255, 134, 219, 196, 255, 79, 187, 213, 243, 207, 25, 67, 147, 162, 196, 121, 241, 37, 37, 66, 167, 162, 196, 140, 244, 163, 223, 7, 147, 162, 196, 49, 242, 249, 234, 6, 167, 162, 196, 66, 232, 182, 35, 187, 200, 76, 175, 234, 241, 152, 36, 202, 221, 76, 175, 131, 231, 48, 224, 5, 201, 76, 175, 43, 241, 19, 225, 20, 222, 76, 175, 105, 51, 132, 29, 236, 174, 249, 209, 71, 41, 83, 65, 80, 195, 249, 209, 45, 51, 117, 195, 2, 174, 249, 209, 12, 41, 68, 231, 101, 194, 249, 209, 46, 37, 6, 30, 147, 218, 222, 184, 12, 41, 208, 39, 103, 239, 222, 184, 14, 37, 249, 220, 89, 218, 222, 184, 235, 40, 195, 230, 45, 239, 222, 184, 41, 88, 67, 41, 156, 225, 79, 187, 171, 90, 213, 54, 57, 246, 79, 187, 131, 87, 243, 205, 97, 225, 79, 187, 5, 90, 134, 219, 254, 245, 79, 187, 129, 78, 207, 25, 125, 137, 162, 196, 38, 76, 37, 37, 124, 157, 162, 196, 57, 79, 163, 223, 65, 137, 162, 196, 222, 76, 249, 234, 64, 157, 162, 196, 238, 66, 182, 35, 246, 190, 76, 175, 151, 76, 152, 36, 5, 212, 76, 175, 47, 66, 48, 224, 64, 191, 76, 175, 216, 75, 19, 225, 79, 212, 76, 175, 26, 129, 124, 246, 26, 129, 124, 246, 26, 129, 124, 246, 26, 129, 124, 246, 186, 126, 181, 249, 186, 126, 181, 249, 186, 126, 181, 249, 186, 126, 181, 249, 69, 133, 104, 251, 69, 133, 104, 251, 69, 133, 104, 251, 69, 133, 104, 251, 203, 136, 42, 254, 203, 136, 42, 254, 203, 136, 42, 254, 203, 136, 42, 254, 207, 128, 172, 254, 207, 128, 172, 254, 207, 128, 172, 254, 207, 128, 172, 254, 42, 130, 128, 251, 42, 130, 128, 251, 42, 130, 128, 251, 42, 130, 128, 251, 137, 130, 8, 252, 137, 130, 8, 252, 137, 130, 8, 252, 137, 130, 8, 252, 1, 133, 108, 244, 1, 133, 108, 244, 1, 133, 108, 244, 1, 133, 108, 244, 163, 129, 68, 246, 163, 129, 68, 246, 163, 129, 68, 246, 163, 129, 68, 246, 88, 124, 212, 253, 88, 124, 212, 253, 88, 124, 212, 253, 88, 124, 212, 253, 42, 130, 128, 251, 42, 130, 128, 251, 42, 130, 128, 251, 42, 130, 128, 251, 137, 130, 8, 252, 137, 130, 8, 252, 137, 130, 8, 252, 137, 130, 8, 252, 1, 133, 108, 244, 1, 133, 108, 244, 1, 133, 108, 244, 1, 133, 108, 244, 163, 129, 68, 246, 163, 129, 68, 246, 163, 129, 68, 246, 163, 129, 68, 246, 88, 124, 212, 253, 88, 124, 212, 253, 88, 124, 212, 253, 88, 124, 212, 253, 98, 119, 21, 253, 98, 119, 21, 253, 98, 119, 21, 253, 98, 119, 21, 253, 73, 131, 4, 252, 73, 131, 4, 252, 73, 131, 4, 252, 73, 131, 4, 252, 228, 120, 53, 249, 228, 120, 53, 249, 228, 120, 53, 249, 228, 120, 53, 249, 116, 132, 104, 251, 116, 132, 104, 251, 116, 132, 104, 251, 116, 132, 104, 251, 243, 118, 236, 243, 243, 118, 236, 243, 243, 118, 236, 243, 243, 118, 236, 243, 81, 132, 78, 247, 81, 132, 78, 247, 81, 132, 78, 247, 81, 132, 78, 247, 30, 129, 134, 252, 30, 129, 134, 252, 30, 129, 134, 252, 30, 129, 134, 252, 162, 132, 187, 245, 162, 132, 187, 245, 162, 132, 187, 245, 162, 132, 187, 245, 79, 131, 116, 248, 79, 131, 116, 248, 79, 131, 116, 248, 79, 131, 116, 248, 158, 132, 191, 246, 158, 132, 191, 246, 158, 132, 191, 246, 158, 132, 191, 246, 140, 137, 145, 253, 140, 137, 145, 253, 140, 137, 145, 253, 140, 137, 145, 253, 61, 131, 17, 255, 61, 131, 17, 255, 61, 131, 17, 255, 61, 131, 17, 255, 50, 119, 135, 253, 50, 119, 135, 253, 50, 119, 135, 253, 50, 119, 135, 253, 41, 133, 168, 248, 41, 133, 168, 248, 41, 133, 168, 248, 41, 133, 168, 248, 146, 116, 62, 249, 146, 116, 62, 249, 146, 116, 62, 249, 146, 116, 62, 249, 140, 137, 145, 253, 140, 137, 145, 253, 140, 137, 145, 253, 140, 137, 145, 253, 61, 131, 17, 255, 61, 131, 17, 255, 61, 131, 17, 255, 61, 131, 17, 255, 50, 119, 135, 253, 50, 119, 135, 253, 50, 119, 135, 253, 50, 119, 135, 253, 41, 133, 168, 248, 41, 133, 168, 248, 41, 133, 168, 248, 41, 133, 168, 248, 146, 116, 62, 249, 146, 116, 62, 249, 146, 116, 62, 249, 146, 116, 62, 249)
|
178 |
+
}, {
|
179 |
+
"aabb": AABB(-8.36209, -0.222683, -9.15225, 16.4609, 0.919043, 18.7848),
|
180 |
+
"attribute_data": PackedByteArray(0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0),
|
181 |
+
"format": 34896613399,
|
182 |
+
"index_count": 210,
|
183 |
+
"index_data": PackedByteArray(0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0, 4, 0, 7, 0, 5, 0, 4, 0, 6, 0, 7, 0, 8, 0, 11, 0, 9, 0, 8, 0, 10, 0, 11, 0, 12, 0, 15, 0, 13, 0, 12, 0, 14, 0, 15, 0, 16, 0, 19, 0, 17, 0, 16, 0, 18, 0, 19, 0, 20, 0, 23, 0, 21, 0, 20, 0, 22, 0, 23, 0, 24, 0, 27, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 31, 0, 29, 0, 28, 0, 30, 0, 31, 0, 32, 0, 35, 0, 33, 0, 32, 0, 34, 0, 35, 0, 36, 0, 39, 0, 37, 0, 36, 0, 38, 0, 39, 0, 40, 0, 43, 0, 41, 0, 40, 0, 42, 0, 43, 0, 44, 0, 47, 0, 45, 0, 44, 0, 46, 0, 47, 0, 48, 0, 51, 0, 49, 0, 48, 0, 50, 0, 51, 0, 52, 0, 55, 0, 53, 0, 52, 0, 54, 0, 55, 0, 56, 0, 59, 0, 57, 0, 56, 0, 58, 0, 59, 0, 60, 0, 63, 0, 61, 0, 60, 0, 62, 0, 63, 0, 64, 0, 67, 0, 65, 0, 64, 0, 66, 0, 67, 0, 68, 0, 71, 0, 69, 0, 68, 0, 70, 0, 71, 0, 72, 0, 75, 0, 73, 0, 72, 0, 74, 0, 75, 0, 76, 0, 79, 0, 77, 0, 76, 0, 78, 0, 79, 0, 80, 0, 83, 0, 81, 0, 80, 0, 82, 0, 83, 0, 84, 0, 87, 0, 85, 0, 84, 0, 86, 0, 87, 0, 88, 0, 91, 0, 89, 0, 88, 0, 90, 0, 91, 0, 92, 0, 95, 0, 93, 0, 92, 0, 94, 0, 95, 0, 96, 0, 99, 0, 97, 0, 96, 0, 98, 0, 99, 0, 100, 0, 103, 0, 101, 0, 100, 0, 102, 0, 103, 0, 104, 0, 107, 0, 105, 0, 104, 0, 106, 0, 107, 0, 108, 0, 111, 0, 109, 0, 108, 0, 110, 0, 111, 0, 112, 0, 115, 0, 113, 0, 112, 0, 114, 0, 115, 0, 116, 0, 119, 0, 117, 0, 116, 0, 118, 0, 119, 0, 120, 0, 123, 0, 121, 0, 120, 0, 122, 0, 123, 0, 124, 0, 127, 0, 125, 0, 124, 0, 126, 0, 127, 0, 128, 0, 131, 0, 129, 0, 128, 0, 130, 0, 131, 0, 132, 0, 135, 0, 133, 0, 132, 0, 134, 0, 135, 0, 136, 0, 139, 0, 137, 0, 136, 0, 138, 0, 139, 0),
|
184 |
+
"material": SubResource("ShaderMaterial_pa0jt"),
|
185 |
+
"name": "grass2",
|
186 |
+
"primitive": 3,
|
187 |
+
"uv_scale": Vector4(0, 0, 0, 0),
|
188 |
+
"vertex_count": 140,
|
189 |
+
"vertex_data": PackedByteArray(115, 71, 218, 24, 55, 131, 1, 179, 215, 78, 214, 60, 164, 150, 1, 179, 60, 71, 235, 196, 131, 130, 1, 179, 160, 78, 231, 232, 241, 149, 1, 179, 73, 67, 14, 22, 105, 60, 91, 209, 176, 56, 92, 24, 225, 80, 91, 209, 224, 66, 101, 233, 49, 60, 91, 209, 71, 56, 179, 235, 168, 80, 91, 209, 64, 61, 133, 37, 117, 9, 130, 180, 251, 67, 225, 42, 189, 29, 130, 180, 155, 60, 224, 214, 130, 9, 130, 180, 86, 67, 60, 220, 202, 29, 130, 180, 12, 96, 9, 39, 14, 0, 184, 176, 27, 104, 129, 47, 252, 17, 184, 176, 167, 95, 64, 210, 0, 0, 184, 176, 182, 103, 184, 218, 238, 17, 184, 176, 47, 103, 137, 31, 75, 10, 132, 179, 233, 109, 180, 34, 238, 28, 132, 179, 75, 103, 13, 223, 48, 10, 132, 179, 5, 110, 56, 226, 210, 28, 132, 179, 75, 255, 98, 24, 152, 2, 187, 192, 223, 254, 129, 26, 114, 24, 187, 192, 255, 255, 64, 231, 142, 2, 187, 192, 146, 255, 95, 233, 104, 24, 187, 192, 123, 217, 246, 34, 195, 43, 37, 187, 151, 220, 113, 66, 240, 65, 37, 187, 194, 217, 80, 191, 52, 43, 37, 187, 221, 220, 203, 222, 96, 65, 37, 187, 127, 194, 227, 56, 189, 35, 30, 183, 28, 200, 72, 44, 241, 57, 30, 183, 172, 194, 121, 213, 235, 35, 30, 183, 73, 200, 222, 200, 31, 58, 30, 183, 172, 178, 255, 5, 95, 100, 224, 195, 147, 176, 88, 21, 50, 120, 224, 195, 151, 179, 105, 236, 5, 100, 224, 195, 125, 177, 194, 251, 216, 119, 224, 195, 165, 168, 6, 5, 122, 31, 9, 200, 66, 164, 218, 30, 36, 51, 9, 200, 183, 169, 231, 226, 246, 30, 9, 200, 85, 165, 187, 252, 160, 50, 9, 200, 15, 93, 98, 24, 121, 140, 187, 192, 163, 92, 129, 26, 83, 162, 187, 192, 194, 93, 64, 231, 111, 140, 187, 192, 86, 93, 95, 233, 73, 162, 187, 192, 2, 61, 246, 34, 99, 160, 37, 187, 30, 64, 113, 66, 144, 182, 37, 187, 73, 61, 80, 191, 211, 159, 37, 187, 100, 64, 203, 222, 0, 182, 37, 187, 124, 41, 227, 56, 81, 156, 30, 183, 25, 47, 72, 44, 133, 178, 30, 183, 169, 41, 121, 213, 127, 156, 30, 183, 70, 47, 222, 200, 179, 178, 30, 183, 187, 28, 255, 5, 65, 188, 224, 195, 161, 26, 88, 21, 20, 208, 224, 195, 166, 29, 105, 236, 231, 187, 224, 195, 140, 27, 194, 251, 186, 207, 224, 195, 119, 20, 6, 5, 24, 155, 9, 200, 20, 16, 218, 30, 194, 174, 9, 200, 138, 21, 231, 226, 149, 154, 9, 200, 39, 17, 187, 252, 63, 174, 9, 200, 69, 99, 89, 8, 63, 45, 151, 208, 220, 89, 129, 27, 130, 64, 151, 208, 77, 100, 64, 230, 27, 45, 151, 208, 228, 90, 104, 249, 94, 64, 151, 208, 136, 60, 229, 16, 33, 72, 231, 207, 11, 51, 16, 34, 89, 92, 231, 207, 200, 60, 177, 223, 205, 71, 231, 207, 76, 51, 220, 240, 5, 92, 231, 207, 50, 66, 106, 13, 150, 49, 89, 188, 77, 68, 184, 37, 47, 69, 89, 188, 235, 66, 9, 220, 234, 48, 89, 188, 6, 69, 87, 244, 130, 68, 89, 188, 178, 33, 149, 11, 251, 76, 141, 195, 203, 31, 201, 21, 58, 96, 141, 195, 35, 34, 248, 235, 186, 76, 141, 195, 59, 32, 44, 246, 249, 95, 141, 195, 58, 98, 240, 18, 167, 77, 163, 206, 96, 90, 95, 30, 0, 96, 163, 206, 167, 98, 98, 227, 124, 77, 163, 206, 206, 90, 209, 238, 212, 95, 163, 206, 72, 242, 0, 0, 57, 111, 152, 186, 56, 245, 115, 2, 202, 129, 152, 186, 154, 240, 75, 214, 92, 111, 152, 186, 138, 243, 190, 216, 237, 129, 152, 186, 133, 191, 39, 11, 239, 105, 159, 188, 129, 193, 226, 10, 187, 125, 159, 188, 246, 192, 219, 205, 212, 105, 159, 188, 242, 194, 151, 205, 160, 125, 159, 188, 172, 240, 4, 26, 48, 128, 247, 199, 11, 236, 146, 26, 31, 149, 247, 199, 90, 239, 44, 190, 244, 127, 247, 199, 186, 234, 186, 190, 227, 148, 247, 199, 131, 189, 179, 19, 171, 130, 241, 185, 130, 193, 123, 18, 243, 152, 241, 185, 246, 187, 66, 198, 232, 130, 241, 185, 245, 191, 11, 197, 47, 153, 241, 185, 33, 200, 203, 14, 32, 113, 111, 185, 44, 204, 5, 12, 75, 134, 111, 185, 220, 198, 185, 204, 95, 113, 111, 185, 231, 202, 243, 201, 138, 134, 111, 185, 101, 191, 88, 29, 161, 162, 201, 189, 188, 192, 195, 1, 47, 184, 201, 189, 39, 192, 255, 255, 73, 163, 201, 189, 126, 193, 105, 228, 216, 184, 201, 189, 40, 175, 223, 4, 200, 198, 126, 198, 58, 171, 246, 21, 147, 220, 126, 198, 36, 176, 203, 235, 124, 198, 126, 198, 54, 172, 226, 252, 71, 220, 126, 198, 97, 183, 124, 32, 76, 235, 2, 186, 251, 186, 249, 56, 255, 255, 2, 186, 246, 183, 200, 200, 190, 234, 2, 186, 144, 187, 69, 225, 113, 255, 2, 186, 204, 187, 230, 55, 170, 204, 75, 196, 133, 185, 3, 45, 233, 223, 75, 196, 43, 187, 190, 212, 210, 204, 75, 196, 228, 184, 219, 201, 16, 224, 75, 196, 22, 238, 125, 37, 95, 186, 196, 177, 160, 245, 201, 43, 132, 204, 196, 177, 227, 237, 248, 213, 74, 186, 196, 177, 109, 245, 69, 220, 111, 204, 196, 177, 43, 20, 88, 29, 82, 153, 201, 189, 129, 21, 195, 1, 225, 174, 201, 189, 237, 20, 254, 255, 250, 153, 201, 189, 68, 22, 105, 228, 137, 175, 201, 189, 237, 3, 223, 4, 121, 189, 126, 198, 0, 0, 246, 21, 68, 211, 126, 198, 233, 4, 203, 235, 45, 189, 126, 198, 252, 0, 226, 252, 248, 210, 126, 198, 39, 12, 124, 32, 254, 225, 2, 186, 193, 15, 249, 56, 176, 246, 2, 186, 188, 12, 200, 200, 112, 225, 2, 186, 86, 16, 69, 225, 34, 246, 2, 186, 145, 16, 230, 55, 92, 195, 75, 196, 74, 14, 3, 45, 154, 214, 75, 196, 241, 15, 190, 212, 131, 195, 75, 196, 170, 13, 219, 201, 194, 214, 75, 196, 219, 66, 124, 37, 17, 177, 196, 177, 102, 74, 201, 43, 54, 195, 196, 177, 168, 66, 248, 213, 251, 176, 196, 177, 51, 74, 69, 220, 32, 195, 196, 177, 254, 139, 153, 250, 254, 139, 153, 250, 254, 139, 153, 250, 254, 139, 153, 250, 255, 123, 178, 254, 255, 123, 178, 254, 255, 123, 178, 254, 255, 123, 178, 254, 229, 118, 172, 251, 229, 118, 172, 251, 229, 118, 172, 251, 229, 118, 172, 251, 249, 121, 22, 254, 249, 121, 22, 254, 249, 121, 22, 254, 249, 121, 22, 254, 158, 129, 60, 254, 158, 129, 60, 254, 158, 129, 60, 254, 158, 129, 60, 254, 223, 131, 192, 248, 223, 131, 192, 248, 223, 131, 192, 248, 223, 131, 192, 248, 7, 137, 51, 249, 7, 137, 51, 249, 7, 137, 51, 249, 7, 137, 51, 249, 113, 127, 110, 252, 113, 127, 110, 252, 113, 127, 110, 252, 113, 127, 110, 252, 250, 133, 255, 247, 250, 133, 255, 247, 250, 133, 255, 247, 250, 133, 255, 247, 116, 135, 31, 247, 116, 135, 31, 247, 116, 135, 31, 247, 116, 135, 31, 247, 223, 131, 192, 248, 223, 131, 192, 248, 223, 131, 192, 248, 223, 131, 192, 248, 7, 137, 51, 249, 7, 137, 51, 249, 7, 137, 51, 249, 7, 137, 51, 249, 113, 127, 110, 252, 113, 127, 110, 252, 113, 127, 110, 252, 113, 127, 110, 252, 250, 133, 255, 247, 250, 133, 255, 247, 250, 133, 255, 247, 250, 133, 255, 247, 116, 135, 31, 247, 116, 135, 31, 247, 116, 135, 31, 247, 116, 135, 31, 247, 129, 133, 249, 247, 129, 133, 249, 247, 129, 133, 249, 247, 129, 133, 249, 247, 210, 131, 73, 253, 210, 131, 73, 253, 210, 131, 73, 253, 210, 131, 73, 253, 26, 136, 195, 247, 26, 136, 195, 247, 26, 136, 195, 247, 26, 136, 195, 247, 118, 131, 246, 251, 118, 131, 246, 251, 118, 131, 246, 251, 118, 131, 246, 251, 0, 131, 114, 252, 0, 131, 114, 252, 0, 131, 114, 252, 0, 131, 114, 252, 50, 111, 102, 247, 50, 111, 102, 247, 50, 111, 102, 247, 50, 111, 102, 247, 21, 136, 109, 240, 21, 136, 109, 240, 21, 136, 109, 240, 21, 136, 109, 240, 242, 112, 66, 249, 242, 112, 66, 249, 242, 112, 66, 249, 242, 112, 66, 249, 101, 109, 207, 245, 101, 109, 207, 245, 101, 109, 207, 245, 101, 109, 207, 245, 5, 113, 126, 247, 5, 113, 126, 247, 5, 113, 126, 247, 5, 113, 126, 247, 211, 127, 114, 248, 211, 127, 114, 248, 211, 127, 114, 248, 211, 127, 114, 248, 231, 133, 197, 247, 231, 133, 197, 247, 231, 133, 197, 247, 231, 133, 197, 247, 87, 136, 97, 247, 87, 136, 97, 247, 87, 136, 97, 247, 87, 136, 97, 247, 250, 119, 158, 250, 250, 119, 158, 250, 250, 119, 158, 250, 250, 119, 158, 250, 46, 125, 151, 255, 46, 125, 151, 255, 46, 125, 151, 255, 46, 125, 151, 255, 211, 127, 114, 248, 211, 127, 114, 248, 211, 127, 114, 248, 211, 127, 114, 248, 231, 133, 197, 247, 231, 133, 197, 247, 231, 133, 197, 247, 231, 133, 197, 247, 87, 136, 97, 247, 87, 136, 97, 247, 87, 136, 97, 247, 87, 136, 97, 247, 250, 119, 158, 250, 250, 119, 158, 250, 250, 119, 158, 250, 250, 119, 158, 250, 46, 125, 151, 255, 46, 125, 151, 255, 46, 125, 151, 255, 46, 125, 151, 255)
|
190 |
+
}, {
|
191 |
+
"aabb": AABB(-8.38425, -0.244321, -8.59889, 16.6521, 0.950857, 18.4937),
|
192 |
+
"attribute_data": PackedByteArray(0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0),
|
193 |
+
"format": 34896613399,
|
194 |
+
"index_count": 204,
|
195 |
+
"index_data": PackedByteArray(0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0, 4, 0, 7, 0, 5, 0, 4, 0, 6, 0, 7, 0, 8, 0, 11, 0, 9, 0, 8, 0, 10, 0, 11, 0, 12, 0, 15, 0, 13, 0, 12, 0, 14, 0, 15, 0, 16, 0, 19, 0, 17, 0, 16, 0, 18, 0, 19, 0, 20, 0, 23, 0, 21, 0, 20, 0, 22, 0, 23, 0, 24, 0, 27, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 31, 0, 29, 0, 28, 0, 30, 0, 31, 0, 32, 0, 35, 0, 33, 0, 32, 0, 34, 0, 35, 0, 36, 0, 39, 0, 37, 0, 36, 0, 38, 0, 39, 0, 40, 0, 43, 0, 41, 0, 40, 0, 42, 0, 43, 0, 44, 0, 47, 0, 45, 0, 44, 0, 46, 0, 47, 0, 48, 0, 51, 0, 49, 0, 48, 0, 50, 0, 51, 0, 52, 0, 55, 0, 53, 0, 52, 0, 54, 0, 55, 0, 56, 0, 59, 0, 57, 0, 56, 0, 58, 0, 59, 0, 60, 0, 63, 0, 61, 0, 60, 0, 62, 0, 63, 0, 64, 0, 67, 0, 65, 0, 64, 0, 66, 0, 67, 0, 68, 0, 71, 0, 69, 0, 68, 0, 70, 0, 71, 0, 72, 0, 75, 0, 73, 0, 72, 0, 74, 0, 75, 0, 76, 0, 79, 0, 77, 0, 76, 0, 78, 0, 79, 0, 80, 0, 83, 0, 81, 0, 80, 0, 82, 0, 83, 0, 84, 0, 87, 0, 85, 0, 84, 0, 86, 0, 87, 0, 88, 0, 91, 0, 89, 0, 88, 0, 90, 0, 91, 0, 92, 0, 95, 0, 93, 0, 92, 0, 94, 0, 95, 0, 96, 0, 99, 0, 97, 0, 96, 0, 98, 0, 99, 0, 100, 0, 103, 0, 101, 0, 100, 0, 102, 0, 103, 0, 104, 0, 107, 0, 105, 0, 104, 0, 106, 0, 107, 0, 108, 0, 111, 0, 109, 0, 108, 0, 110, 0, 111, 0, 112, 0, 115, 0, 113, 0, 112, 0, 114, 0, 115, 0, 116, 0, 119, 0, 117, 0, 116, 0, 118, 0, 119, 0, 120, 0, 123, 0, 121, 0, 120, 0, 122, 0, 123, 0, 124, 0, 127, 0, 125, 0, 124, 0, 126, 0, 127, 0, 128, 0, 131, 0, 129, 0, 128, 0, 130, 0, 131, 0, 132, 0, 135, 0, 133, 0, 132, 0, 134, 0, 135, 0),
|
196 |
+
"material": SubResource("ShaderMaterial_og20f"),
|
197 |
+
"name": "grass3",
|
198 |
+
"primitive": 3,
|
199 |
+
"uv_scale": Vector4(0, 0, 0, 0),
|
200 |
+
"vertex_count": 136,
|
201 |
+
"vertex_data": PackedByteArray(51, 101, 23, 48, 255, 50, 16, 196, 255, 98, 49, 47, 215, 70, 16, 196, 123, 101, 151, 213, 11, 51, 16, 196, 71, 99, 177, 212, 226, 70, 16, 196, 187, 11, 28, 30, 151, 4, 174, 208, 218, 1, 76, 44, 37, 25, 174, 208, 71, 12, 123, 216, 119, 4, 174, 208, 102, 2, 172, 230, 5, 25, 174, 208, 141, 9, 185, 52, 51, 15, 53, 208, 90, 0, 154, 46, 233, 34, 53, 208, 230, 9, 46, 214, 118, 15, 53, 208, 178, 0, 15, 208, 45, 35, 53, 208, 15, 70, 195, 46, 197, 10, 114, 195, 7, 68, 205, 52, 135, 32, 114, 195, 119, 70, 250, 207, 174, 10, 114, 195, 111, 68, 4, 214, 113, 32, 114, 195, 224, 179, 73, 31, 253, 73, 82, 196, 48, 177, 118, 26, 188, 96, 82, 196, 199, 179, 82, 234, 24, 74, 82, 196, 22, 177, 126, 229, 215, 96, 82, 196, 241, 199, 196, 31, 54, 39, 236, 199, 148, 195, 174, 38, 52, 59, 236, 199, 63, 200, 26, 222, 23, 39, 236, 199, 225, 195, 4, 229, 21, 59, 236, 199, 122, 245, 123, 48, 0, 0, 252, 175, 52, 255, 179, 55, 20, 21, 252, 175, 250, 244, 21, 205, 11, 0, 252, 175, 179, 254, 76, 212, 32, 21, 252, 175, 212, 230, 119, 68, 24, 34, 125, 192, 152, 230, 74, 37, 9, 54, 125, 192, 216, 230, 126, 223, 188, 34, 125, 192, 156, 230, 81, 192, 173, 54, 125, 192, 255, 255, 247, 51, 140, 59, 142, 195, 202, 253, 166, 47, 62, 82, 142, 195, 234, 255, 34, 213, 159, 59, 142, 195, 181, 253, 209, 208, 81, 82, 142, 195, 82, 31, 73, 31, 248, 172, 82, 196, 161, 28, 118, 26, 182, 195, 82, 196, 57, 31, 82, 234, 18, 173, 82, 196, 136, 28, 126, 229, 209, 195, 82, 196, 76, 48, 196, 31, 245, 156, 236, 199, 239, 43, 174, 38, 243, 176, 236, 199, 154, 48, 26, 222, 214, 156, 236, 199, 61, 44, 4, 229, 212, 176, 236, 199, 139, 85, 123, 48, 183, 137, 252, 175, 68, 95, 179, 55, 203, 158, 252, 175, 10, 85, 21, 205, 194, 137, 252, 175, 196, 94, 76, 212, 215, 158, 252, 175, 248, 73, 119, 68, 78, 154, 125, 192, 188, 73, 74, 37, 63, 174, 125, 192, 252, 73, 126, 223, 242, 154, 125, 192, 192, 73, 81, 192, 227, 174, 125, 192, 77, 95, 247, 51, 5, 166, 142, 195, 24, 93, 166, 47, 183, 188, 142, 195, 56, 95, 34, 213, 24, 166, 142, 195, 3, 93, 209, 208, 202, 188, 142, 195, 117, 86, 218, 36, 147, 72, 24, 181, 86, 92, 201, 4, 208, 91, 24, 181, 93, 87, 255, 255, 80, 73, 24, 181, 63, 93, 238, 223, 142, 92, 24, 181, 237, 51, 91, 19, 49, 83, 9, 175, 241, 60, 64, 52, 118, 101, 9, 175, 79, 51, 136, 208, 138, 82, 9, 175, 83, 60, 109, 241, 207, 100, 9, 175, 120, 63, 204, 50, 60, 52, 16, 210, 80, 53, 203, 44, 125, 71, 16, 210, 119, 63, 252, 215, 94, 52, 16, 210, 78, 53, 252, 209, 159, 71, 16, 210, 86, 31, 242, 33, 205, 43, 204, 190, 18, 32, 111, 63, 74, 66, 204, 190, 151, 30, 89, 197, 65, 43, 204, 190, 83, 31, 214, 226, 190, 65, 204, 190, 146, 67, 88, 39, 156, 57, 78, 195, 224, 65, 218, 44, 155, 76, 78, 195, 200, 66, 238, 215, 107, 57, 78, 195, 22, 65, 112, 221, 105, 76, 78, 195, 0, 184, 63, 28, 89, 119, 50, 188, 38, 186, 22, 26, 241, 139, 50, 188, 183, 183, 14, 195, 107, 119, 50, 188, 221, 185, 229, 192, 3, 140, 50, 188, 203, 203, 0, 0, 136, 130, 230, 186, 250, 206, 244, 3, 57, 152, 230, 186, 132, 205, 48, 217, 57, 130, 230, 186, 179, 208, 36, 221, 234, 151, 230, 186, 86, 216, 235, 15, 48, 115, 130, 189, 189, 217, 50, 15, 175, 135, 130, 189, 237, 215, 242, 205, 58, 115, 130, 189, 83, 217, 57, 205, 186, 135, 130, 189, 34, 200, 140, 16, 53, 115, 31, 190, 75, 201, 48, 13, 205, 134, 31, 190, 102, 198, 243, 207, 96, 115, 31, 190, 143, 199, 152, 204, 248, 134, 31, 190, 186, 245, 97, 23, 82, 141, 163, 196, 56, 243, 240, 24, 19, 162, 163, 196, 34, 244, 52, 196, 33, 141, 163, 196, 160, 241, 194, 197, 226, 161, 163, 196, 67, 169, 54, 51, 223, 236, 172, 181, 202, 174, 79, 45, 255, 255, 172, 181, 246, 169, 121, 215, 215, 236, 172, 181, 125, 175, 146, 209, 247, 255, 172, 181, 148, 200, 103, 58, 229, 154, 141, 194, 48, 199, 230, 48, 200, 174, 141, 194, 217, 200, 226, 211, 26, 155, 141, 194, 117, 199, 97, 202, 254, 174, 141, 194, 84, 218, 121, 26, 217, 173, 41, 201, 32, 213, 97, 59, 114, 194, 41, 201, 124, 218, 102, 201, 36, 173, 41, 201, 71, 213, 79, 234, 189, 193, 41, 201, 137, 230, 90, 23, 218, 193, 153, 174, 59, 241, 28, 39, 212, 214, 153, 174, 15, 231, 172, 221, 62, 193, 153, 174, 193, 241, 110, 237, 56, 214, 153, 174, 37, 200, 173, 10, 199, 184, 56, 179, 236, 207, 92, 31, 5, 206, 56, 179, 233, 200, 108, 229, 252, 183, 56, 179, 176, 208, 27, 250, 59, 205, 56, 179, 0, 0, 54, 51, 106, 227, 172, 181, 135, 5, 79, 45, 138, 246, 172, 181, 178, 0, 121, 215, 99, 227, 172, 181, 57, 6, 146, 209, 131, 246, 172, 181, 80, 31, 103, 58, 112, 145, 141, 194, 237, 29, 230, 48, 84, 165, 141, 194, 149, 31, 226, 211, 166, 145, 141, 194, 50, 30, 97, 202, 138, 165, 141, 194, 17, 49, 121, 26, 101, 164, 41, 201, 220, 43, 97, 59, 253, 184, 41, 201, 56, 49, 102, 201, 176, 163, 41, 201, 4, 44, 79, 234, 72, 184, 41, 201, 69, 61, 90, 23, 102, 184, 153, 174, 248, 71, 28, 39, 96, 205, 153, 174, 203, 61, 172, 221, 202, 183, 153, 174, 126, 72, 110, 237, 196, 204, 153, 174, 226, 30, 173, 10, 82, 175, 56, 179, 169, 38, 92, 31, 145, 196, 56, 179, 165, 31, 108, 229, 136, 174, 56, 179, 108, 39, 27, 250, 199, 195, 56, 179, 140, 129, 112, 252, 140, 129, 112, 252, 140, 129, 112, 252, 140, 129, 112, 252, 178, 131, 6, 251, 178, 131, 6, 251, 178, 131, 6, 251, 178, 131, 6, 251, 1, 129, 127, 251, 1, 129, 127, 251, 1, 129, 127, 251, 1, 129, 127, 251, 81, 131, 209, 250, 81, 131, 209, 250, 81, 131, 209, 250, 81, 131, 209, 250, 229, 126, 188, 254, 229, 126, 188, 254, 229, 126, 188, 254, 229, 126, 188, 254, 96, 130, 241, 252, 96, 130, 241, 252, 96, 130, 241, 252, 96, 130, 241, 252, 110, 119, 30, 252, 110, 119, 30, 252, 110, 119, 30, 252, 110, 119, 30, 252, 99, 123, 136, 246, 99, 123, 136, 246, 99, 123, 136, 246, 99, 123, 136, 246, 234, 126, 218, 254, 234, 126, 218, 254, 234, 126, 218, 254, 234, 126, 218, 254, 229, 126, 188, 254, 229, 126, 188, 254, 229, 126, 188, 254, 229, 126, 188, 254, 96, 130, 241, 252, 96, 130, 241, 252, 96, 130, 241, 252, 96, 130, 241, 252, 110, 119, 30, 252, 110, 119, 30, 252, 110, 119, 30, 252, 110, 119, 30, 252, 98, 123, 136, 246, 98, 123, 136, 246, 98, 123, 136, 246, 98, 123, 136, 246, 234, 126, 218, 254, 234, 126, 218, 254, 234, 126, 218, 254, 234, 126, 218, 254, 48, 127, 184, 245, 48, 127, 184, 245, 48, 127, 184, 245, 48, 127, 184, 245, 176, 139, 83, 253, 176, 139, 83, 253, 176, 139, 83, 253, 176, 139, 83, 253, 83, 127, 92, 254, 83, 127, 92, 254, 83, 127, 92, 254, 83, 127, 92, 254, 135, 118, 63, 255, 135, 118, 63, 255, 135, 118, 63, 255, 135, 118, 63, 255, 244, 118, 130, 252, 244, 118, 130, 252, 244, 118, 130, 252, 244, 118, 130, 252, 21, 124, 153, 253, 21, 124, 153, 253, 21, 124, 153, 253, 21, 124, 153, 253, 115, 137, 76, 239, 115, 137, 76, 239, 115, 137, 76, 239, 115, 137, 76, 239, 41, 123, 99, 253, 41, 123, 99, 253, 41, 123, 99, 253, 41, 123, 99, 253, 26, 110, 79, 246, 26, 110, 79, 246, 26, 110, 79, 246, 26, 110, 79, 246, 1, 111, 42, 248, 1, 111, 42, 248, 1, 111, 42, 248, 1, 111, 42, 248, 165, 132, 226, 245, 165, 132, 226, 245, 165, 132, 226, 245, 165, 132, 226, 245, 90, 128, 53, 252, 90, 128, 53, 252, 90, 128, 53, 252, 90, 128, 53, 252, 156, 136, 86, 251, 156, 136, 86, 251, 156, 136, 86, 251, 156, 136, 86, 251, 73, 136, 251, 246, 73, 136, 251, 246, 73, 136, 251, 246, 73, 136, 251, 246, 76, 137, 220, 245, 76, 137, 220, 245, 76, 137, 220, 245, 76, 137, 220, 245, 165, 132, 226, 245, 165, 132, 226, 245, 165, 132, 226, 245, 165, 132, 226, 245, 90, 128, 53, 252, 90, 128, 53, 252, 90, 128, 53, 252, 90, 128, 53, 252, 156, 136, 86, 251, 156, 136, 86, 251, 156, 136, 86, 251, 156, 136, 86, 251, 73, 136, 251, 246, 73, 136, 251, 246, 73, 136, 251, 246, 73, 136, 251, 246, 76, 137, 220, 245, 76, 137, 220, 245, 76, 137, 220, 245, 76, 137, 220, 245)
|
202 |
+
}]
|
203 |
+
blend_shape_mode = 0
|
204 |
+
shadow_mesh = SubResource("ArrayMesh_askja")
|
205 |
+
|
206 |
+
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_7eqbu"]
|
207 |
+
friction = 0.0
|
208 |
+
bounce = 1.0
|
209 |
+
|
210 |
+
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5bx48"]
|
211 |
+
albedo_color = Color(1, 0.94902, 0, 1)
|
212 |
+
|
213 |
+
[sub_resource type="SphereMesh" id="SphereMesh_3ng7x"]
|
214 |
+
radius = 0.235
|
215 |
+
height = 0.469
|
216 |
+
|
217 |
+
[sub_resource type="SphereShape3D" id="SphereShape3D_sg3a8"]
|
218 |
+
margin = 0.455
|
219 |
+
radius = 0.235
|
220 |
+
|
221 |
+
[node name="GameScene" type="Node3D" node_paths=PackedStringArray("players")]
|
222 |
+
script = ExtResource("1_g4wvl")
|
223 |
+
players = [NodePath("Robot"), NodePath("Robot2")]
|
224 |
+
|
225 |
+
[node name="Field" type="Node3D" parent="."]
|
226 |
+
|
227 |
+
[node name="Floor" type="CSGBox3D" parent="Field"]
|
228 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0820313, 0)
|
229 |
+
size = Vector3(6, 0.164, 2)
|
230 |
+
material = SubResource("StandardMaterial3D_si1yy")
|
231 |
+
|
232 |
+
[node name="Net" type="CSGPolygon3D" parent="Field/Floor"]
|
233 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0451662, 1)
|
234 |
+
polygon = PackedVector2Array(-0.05, 0, -0.05, 1, -0.05, 1.03, -0.001, 1.04, 0.05, 1.03, 0.05, 1, 0.05, 0)
|
235 |
+
depth = 2.0
|
236 |
+
material = SubResource("StandardMaterial3D_v4edw")
|
237 |
+
|
238 |
+
[node name="Floor2" type="CSGBox3D" parent="Field"]
|
239 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1)
|
240 |
+
material_override = SubResource("StandardMaterial3D_v4edw")
|
241 |
+
size = Vector3(6, 0.1, 0.1)
|
242 |
+
|
243 |
+
[node name="Floor3" type="CSGBox3D" parent="Field"]
|
244 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1)
|
245 |
+
material_override = SubResource("StandardMaterial3D_v4edw")
|
246 |
+
size = Vector3(6, 0.1, 0.1)
|
247 |
+
|
248 |
+
[node name="Floor4" type="CSGBox3D" parent="Field"]
|
249 |
+
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 3, 0, 0)
|
250 |
+
material_override = SubResource("StandardMaterial3D_v4edw")
|
251 |
+
size = Vector3(2.1, 0.1, 0.1)
|
252 |
+
|
253 |
+
[node name="Floor5" type="CSGBox3D" parent="Field"]
|
254 |
+
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -3, 0, 0)
|
255 |
+
material_override = SubResource("StandardMaterial3D_v4edw")
|
256 |
+
size = Vector3(2.1, 0.1, 0.1)
|
257 |
+
|
258 |
+
[node name="Wall" type="CSGBox3D" parent="Field"]
|
259 |
+
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 3, 1.95, 0)
|
260 |
+
material_override = SubResource("StandardMaterial3D_tsppj")
|
261 |
+
size = Vector3(2.1, 4, 0.1)
|
262 |
+
|
263 |
+
[node name="Wall2" type="CSGBox3D" parent="Field"]
|
264 |
+
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -3, 1.95, -2.62268e-07)
|
265 |
+
material_override = SubResource("StandardMaterial3D_tsppj")
|
266 |
+
size = Vector3(2.1, 4, 0.1)
|
267 |
+
|
268 |
+
[node name="Wall3" type="CSGBox3D" parent="Field"]
|
269 |
+
transform = Transform3D(-4.37114e-08, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, 4.37114e-08, 0, 8.74228e-08, 3.95, 0)
|
270 |
+
material_override = SubResource("StandardMaterial3D_tsppj")
|
271 |
+
size = Vector3(2.1, 6.1, 0.1)
|
272 |
+
|
273 |
+
[node name="FieldColliders" type="StaticBody3D" parent="Field"]
|
274 |
+
|
275 |
+
[node name="CollisionShape3D" type="CollisionShape3D" parent="Field/FieldColliders"]
|
276 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 0.5, 0)
|
277 |
+
shape = SubResource("BoxShape3D_20bsr")
|
278 |
+
|
279 |
+
[node name="CollisionShape3D2" type="CollisionShape3D" parent="Field/FieldColliders"]
|
280 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 1.17, 0)
|
281 |
+
shape = SubResource("BoxShape3D_nucsm")
|
282 |
+
|
283 |
+
[node name="CollisionShape3D5" type="CollisionShape3D" parent="Field/FieldColliders"]
|
284 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 14, 0)
|
285 |
+
shape = SubResource("BoxShape3D_7q7xm")
|
286 |
+
|
287 |
+
[node name="CollisionShape3D6" type="CollisionShape3D" parent="Field/FieldColliders"]
|
288 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -10, 0)
|
289 |
+
shape = SubResource("BoxShape3D_7q7xm")
|
290 |
+
|
291 |
+
[node name="CollisionShape3D7" type="CollisionShape3D" parent="Field/FieldColliders"]
|
292 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.418945, 0)
|
293 |
+
shape = SubResource("BoxShape3D_u865r")
|
294 |
+
|
295 |
+
[node name="CollisionShape3D8" type="CollisionShape3D" parent="Field/FieldColliders"]
|
296 |
+
transform = Transform3D(1.91069e-15, 4.37114e-08, 1, 1, -4.37114e-08, 0, 4.37114e-08, 1, -4.37114e-08, 0, 0.9985, 0)
|
297 |
+
shape = SubResource("CylinderShape3D_ho4bs")
|
298 |
+
|
299 |
+
[node name="Goal" type="Area3D" parent="Field"]
|
300 |
+
process_mode = 1
|
301 |
+
collision_layer = 0
|
302 |
+
collision_mask = 4
|
303 |
+
monitorable = false
|
304 |
+
script = ExtResource("2_ypwf4")
|
305 |
+
|
306 |
+
[node name="CollisionShape3D" type="CollisionShape3D" parent="Field/Goal"]
|
307 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5, -0.4, 0)
|
308 |
+
shape = SubResource("BoxShape3D_efmyo")
|
309 |
+
|
310 |
+
[node name="Goal2" type="Area3D" parent="Field"]
|
311 |
+
process_mode = 1
|
312 |
+
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
313 |
+
collision_layer = 0
|
314 |
+
collision_mask = 4
|
315 |
+
monitorable = false
|
316 |
+
script = ExtResource("2_ypwf4")
|
317 |
+
|
318 |
+
[node name="CollisionShape3D" type="CollisionShape3D" parent="Field/Goal2"]
|
319 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5, -0.4, 0)
|
320 |
+
shape = SubResource("BoxShape3D_efmyo")
|
321 |
+
|
322 |
+
[node name="Decorations" type="Node3D" parent="Field"]
|
323 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0384959, 0)
|
324 |
+
|
325 |
+
[node name="MeshInstance3D" type="MeshInstance3D" parent="Field/Decorations"]
|
326 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0506201, 0)
|
327 |
+
material_override = SubResource("StandardMaterial3D_unsk7")
|
328 |
+
mesh = SubResource("PlaneMesh_o0rtt")
|
329 |
+
skeleton = NodePath("../../..")
|
330 |
+
|
331 |
+
[node name="static_decorations" parent="Field/Decorations" instance=ExtResource("5_5d1h1")]
|
332 |
+
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
|
333 |
+
|
334 |
+
[node name="grass" parent="Field/Decorations/static_decorations" index="2"]
|
335 |
+
mesh = SubResource("ArrayMesh_1dxiy")
|
336 |
+
|
337 |
+
[node name="Robot" parent="." node_paths=PackedStringArray("other_player", "goal") instance=ExtResource("3_y4pr4")]
|
338 |
+
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -1.5, 0.2, 0)
|
339 |
+
other_player = NodePath("../Robot2")
|
340 |
+
goal = NodePath("../Field/Goal")
|
341 |
+
|
342 |
+
[node name="Robot2" parent="." node_paths=PackedStringArray("other_player", "goal") instance=ExtResource("3_y4pr4")]
|
343 |
+
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.5, 0.2, 0)
|
344 |
+
other_player = NodePath("../Robot")
|
345 |
+
goal = NodePath("../Field/Goal2")
|
346 |
+
|
347 |
+
[node name="Ball" type="RigidBody3D" parent="."]
|
348 |
+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.560747, 1.45254, 0)
|
349 |
+
collision_layer = 4
|
350 |
+
collision_mask = 3
|
351 |
+
axis_lock_linear_z = true
|
352 |
+
mass = 0.1
|
353 |
+
physics_material_override = SubResource("PhysicsMaterial_7eqbu")
|
354 |
+
gravity_scale = 1.25
|
355 |
+
sleeping = true
|
356 |
+
lock_rotation = true
|
357 |
+
continuous_cd = true
|
358 |
+
max_contacts_reported = 1
|
359 |
+
contact_monitor = true
|
360 |
+
linear_damp_mode = 1
|
361 |
+
angular_damp_mode = 1
|
362 |
+
script = ExtResource("5_xjnfp")
|
363 |
+
max_velocity = 9.0
|
364 |
+
|
365 |
+
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ball"]
|
366 |
+
material_override = SubResource("StandardMaterial3D_5bx48")
|
367 |
+
mesh = SubResource("SphereMesh_3ng7x")
|
368 |
+
|
369 |
+
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ball"]
|
370 |
+
shape = SubResource("SphereShape3D_sg3a8")
|
371 |
+
|
372 |
+
[connection signal="ball_entered" from="Field/Goal" to="." method="_on_goal_ball_entered"]
|
373 |
+
[connection signal="ball_entered" from="Field/Goal2" to="." method="_on_goal_ball_entered"]
|
374 |
+
[connection signal="body_entered" from="Ball" to="." method="_on_ball_body_entered"]
|
375 |
+
[connection signal="body_entered" from="Ball" to="Ball" method="_on_body_entered"]
|
376 |
+
|
377 |
+
[editable path="Field/Decorations/static_decorations"]
|
scenes/game_scene/goal.gd
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Area3D
|
2 |
+
class_name Goal
|
3 |
+
|
4 |
+
signal ball_entered(goal: Goal)
|
5 |
+
|
6 |
+
|
7 |
+
func _ready():
|
8 |
+
connect("body_entered", on_body_entered)
|
9 |
+
|
10 |
+
|
11 |
+
func on_body_entered(body):
|
12 |
+
if body is Ball:
|
13 |
+
ball_entered.emit(self)
|
scenes/robot/RobotAIController.gd
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends AIController3D
|
2 |
+
class_name RobotAIController
|
3 |
+
|
4 |
+
@onready var robot: Robot = get_parent()
|
5 |
+
@onready var sensors: Array[Node] = $"../Sensors".get_children()
|
6 |
+
|
7 |
+
var steps_without_ball_hit_while_serving: int
|
8 |
+
var is_serving: bool
|
9 |
+
|
10 |
+
|
11 |
+
func reset():
|
12 |
+
super.reset()
|
13 |
+
|
14 |
+
|
15 |
+
func _physics_process(_delta):
|
16 |
+
n_steps += 1
|
17 |
+
|
18 |
+
if is_serving:
|
19 |
+
steps_without_ball_hit_while_serving += 1
|
20 |
+
|
21 |
+
if steps_without_ball_hit_while_serving > 400:
|
22 |
+
reward -= 1
|
23 |
+
robot.other_player.score += 1
|
24 |
+
robot.game_manager.reset_ball(robot.other_player)
|
25 |
+
|
26 |
+
|
27 |
+
func get_obs() -> Dictionary:
|
28 |
+
var ball_position = robot.to_local(robot.ball.global_position) / 8.0
|
29 |
+
var ball_goal_position = robot.goal.to_local(robot.ball.global_position) / 5.0
|
30 |
+
var robot_velocity = (
|
31 |
+
(robot.global_transform.basis.inverse() * robot.linear_velocity.limit_length(10.0)) / 10.0
|
32 |
+
)
|
33 |
+
var ball_velocity = (
|
34 |
+
(robot.global_transform.basis.inverse() * robot.ball.linear_velocity.limit_length(8.0))
|
35 |
+
/ 8.0
|
36 |
+
)
|
37 |
+
|
38 |
+
var observations: Array[float] = [
|
39 |
+
ball_position.y,
|
40 |
+
ball_position.z,
|
41 |
+
ball_goal_position.x,
|
42 |
+
ball_goal_position.z,
|
43 |
+
robot_velocity.y,
|
44 |
+
robot_velocity.z,
|
45 |
+
ball_velocity.y,
|
46 |
+
ball_velocity.z,
|
47 |
+
float(robot.jump_sensor.is_colliding()),
|
48 |
+
float(float(is_serving)),
|
49 |
+
float(robot.ball.ball_served),
|
50 |
+
robot.game_manager.get_hit_ball_count(robot),
|
51 |
+
steps_without_ball_hit_while_serving / 400.0
|
52 |
+
]
|
53 |
+
|
54 |
+
observations.append_array(get_raycast_sensor_obs())
|
55 |
+
|
56 |
+
return {"obs": observations}
|
57 |
+
|
58 |
+
|
59 |
+
func get_reward() -> float:
|
60 |
+
return reward
|
61 |
+
|
62 |
+
|
63 |
+
func get_action_space() -> Dictionary:
|
64 |
+
return {
|
65 |
+
"jump": {"size": 1, "action_type": "continuous"},
|
66 |
+
"movement": {"size": 1, "action_type": "continuous"}
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
func set_action(action) -> void:
|
71 |
+
robot.requested_movement = clamp(action.movement[0], -1.0, 1.0)
|
72 |
+
robot.jump_requested = action.jump[0] > 0
|
73 |
+
|
74 |
+
|
75 |
+
func get_raycast_sensor_obs():
|
76 |
+
var all_raycast_sensor_obs: Array[float] = []
|
77 |
+
for raycast_sensor in sensors:
|
78 |
+
all_raycast_sensor_obs.append_array(raycast_sensor.get_observation())
|
79 |
+
return all_raycast_sensor_obs
|
scenes/robot/robot.gd
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends RigidBody3D
|
2 |
+
class_name Robot
|
3 |
+
|
4 |
+
@export var other_player: Robot
|
5 |
+
@export var goal: Area3D
|
6 |
+
|
7 |
+
@export var wheels: Array[Node3D]
|
8 |
+
|
9 |
+
@export var acceleration: float = 100.0
|
10 |
+
@export var rotation_speed: float = 15.0
|
11 |
+
@export var jump_force: float = 290
|
12 |
+
|
13 |
+
@export var gravity := Vector3.DOWN * 60.0
|
14 |
+
|
15 |
+
@onready var robot_visual: Node3D = $robot
|
16 |
+
@onready var jump_sensor: RayCast3D = $JumpSensor
|
17 |
+
@onready var ai_controller: RobotAIController = $AIController3D
|
18 |
+
@onready var particles: GPUParticles3D = $GPUParticles3D
|
19 |
+
@onready var initial_position = global_position
|
20 |
+
|
21 |
+
var game_manager: GameManager
|
22 |
+
var ball: Ball
|
23 |
+
|
24 |
+
var requested_movement: float
|
25 |
+
var jump_requested: bool
|
26 |
+
var velocity: Vector3
|
27 |
+
var last_movement_direction: float = 1
|
28 |
+
|
29 |
+
## If set, the score from this Robot will be displayed in the label
|
30 |
+
var score_label: Label
|
31 |
+
var score : int:
|
32 |
+
set(value):
|
33 |
+
score = value
|
34 |
+
if score_label:
|
35 |
+
score_label.text = str(value)
|
36 |
+
|
37 |
+
|
38 |
+
func _ready():
|
39 |
+
score = 0
|
40 |
+
reset()
|
41 |
+
|
42 |
+
|
43 |
+
func reset():
|
44 |
+
linear_velocity = Vector3.ZERO
|
45 |
+
global_position = initial_position
|
46 |
+
|
47 |
+
|
48 |
+
func _physics_process(delta):
|
49 |
+
reset_on_needs_reset()
|
50 |
+
handle_movement(delta)
|
51 |
+
|
52 |
+
|
53 |
+
func reset_on_needs_reset():
|
54 |
+
if ai_controller.needs_reset:
|
55 |
+
reset()
|
56 |
+
ai_controller.reset()
|
57 |
+
pass
|
58 |
+
|
59 |
+
|
60 |
+
func handle_movement(delta):
|
61 |
+
var movement := Vector3()
|
62 |
+
|
63 |
+
if ai_controller.heuristic == "human":
|
64 |
+
if Input.is_action_pressed("move_left"):
|
65 |
+
movement.x = -1
|
66 |
+
if Input.is_action_pressed("move_right"):
|
67 |
+
movement.x = 1
|
68 |
+
if Input.is_action_pressed("jump"):
|
69 |
+
if jump_sensor.is_colliding():
|
70 |
+
apply_force(Vector3.UP * jump_force)
|
71 |
+
else:
|
72 |
+
movement = global_basis.z * requested_movement
|
73 |
+
if jump_sensor.is_colliding() and jump_requested:
|
74 |
+
apply_force(Vector3.UP * jump_force)
|
75 |
+
|
76 |
+
if movement:
|
77 |
+
last_movement_direction = sign(movement.x)
|
78 |
+
apply_acceleration(movement.normalized())
|
79 |
+
|
80 |
+
update_particle_effects()
|
81 |
+
update_wheels_and_visual_rotation(delta)
|
82 |
+
rotate_toward_movement(delta)
|
83 |
+
apply_gravity()
|
84 |
+
|
85 |
+
|
86 |
+
func apply_acceleration(direction):
|
87 |
+
apply_force(direction * acceleration)
|
88 |
+
|
89 |
+
|
90 |
+
func apply_gravity():
|
91 |
+
apply_force(gravity)
|
92 |
+
|
93 |
+
|
94 |
+
func rotate_toward_movement(delta):
|
95 |
+
if abs(last_movement_direction) > 0.005:
|
96 |
+
robot_visual.global_transform = (
|
97 |
+
robot_visual
|
98 |
+
. global_transform
|
99 |
+
. interpolate_with(
|
100 |
+
robot_visual.global_transform.looking_at(
|
101 |
+
(
|
102 |
+
robot_visual.global_transform.origin
|
103 |
+
+ Vector3(last_movement_direction, 0, +0.01)
|
104 |
+
)
|
105 |
+
),
|
106 |
+
rotation_speed * delta
|
107 |
+
)
|
108 |
+
. orthonormalized()
|
109 |
+
)
|
110 |
+
|
111 |
+
|
112 |
+
func update_wheels_and_visual_rotation(delta):
|
113 |
+
var abs_movement = abs(linear_velocity.x)
|
114 |
+
|
115 |
+
for wheel in wheels:
|
116 |
+
wheel.rotate_object_local(Vector3.LEFT, abs_movement * 1.3 * delta)
|
117 |
+
robot_visual.rotation.x = -0.01 * abs_movement
|
118 |
+
|
119 |
+
|
120 |
+
func update_particle_effects():
|
121 |
+
if linear_velocity.x > 0.25 and jump_sensor.is_colliding():
|
122 |
+
particles.emitting = true
|
123 |
+
else:
|
124 |
+
particles.emitting = false
|
125 |
+
|
126 |
+
|
127 |
+
func end_episode(reward: float):
|
128 |
+
ai_controller.reward += reward
|
129 |
+
ai_controller.done = true
|
130 |
+
ai_controller.needs_reset = true
|
131 |
+
pass
|