add ground mesh

This commit is contained in:
2024-10-07 06:15:29 +10:00
parent e9ae26a8e6
commit 48672da2bf
12 changed files with 84 additions and 38 deletions

BIN
assets/models/ground.glb LFS Normal file

Binary file not shown.

View File

@@ -0,0 +1,43 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bvowy3qydkn6"
path="res://.godot/imported/ground.glb-e17c227f258a143284935887d72d01b3.scn"
[deps]
source_file="res://assets/models/ground.glb"
dest_files=["res://.godot/imported/ground.glb-e17c227f258a143284935887d72d01b3.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=false
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={
"materials": {
"ground_mat": {
"use_external/enabled": false,
"use_external/path": "res://resources/materials/ground_mat.tres"
}
}
}
gltf/naming_version=1
gltf/embedded_image_handling=1

View File

@@ -0,0 +1,5 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://c1owthx1hbtik"]
[resource]
vertex_color_use_as_albedo = true
metallic_specular = 0.0

View File

@@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=3 uid="uid://brjxxr7h0o0ay"]
[ext_resource type="PackedScene" uid="uid://bvowy3qydkn6" path="res://assets/models/ground.glb" id="1_wapwq"]
[ext_resource type="Material" uid="uid://c1owthx1hbtik" path="res://resources/materials/ground_mat.tres" id="2_pmgjw"]
[node name="Ground" instance=ExtResource("1_wapwq")]
[node name="ground" parent="." index="0"]
surface_material_override/0 = ExtResource("2_pmgjw")

View File

@@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://bi231xk2sp410" path="res://assets/models/ant.glb" id="1_asokb"]
[ext_resource type="Script" path="res://scripts/units/ant_gatherer.gd" id="2_vcqni"]
[ext_resource type="Material" uid="uid://b68amtoih28uv" path="res://resources/materials/ant_gatherer_material.tres" id="3_1br5i"]
[ext_resource type="Material" uid="uid://b68amtoih28uv" path="res://resources/materials/ant_gatherer_mat.tres" id="3_1br5i"]
[ext_resource type="Texture2D" uid="uid://dehqm00kiljut" path="res://assets/textures/selection_unit_decal.png" id="3_5dykx"]
[ext_resource type="Texture2D" uid="uid://duf132faskeid" path="res://assets/textures/selection_unit_hover_decal.png" id="4_1jps0"]
[ext_resource type="PackedScene" uid="uid://fal1ond30jey" path="res://scenes/units/components/gathering.tscn" id="5_wwnxg"]

View File

@@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://bi231xk2sp410" path="res://assets/models/ant.glb" id="1_1u65s"]
[ext_resource type="Script" path="res://scripts/units/ant_nitwit.gd" id="2_f1bdv"]
[ext_resource type="Material" uid="uid://djj2dnbws3ee5" path="res://resources/materials/ant_nitwit_material.tres" id="3_hollj"]
[ext_resource type="Material" uid="uid://djj2dnbws3ee5" path="res://resources/materials/ant_nitwit_mat.tres" id="3_hollj"]
[ext_resource type="Texture2D" uid="uid://dehqm00kiljut" path="res://assets/textures/selection_unit_decal.png" id="3_hxm2m"]
[ext_resource type="Texture2D" uid="uid://duf132faskeid" path="res://assets/textures/selection_unit_hover_decal.png" id="4_vrkmw"]
[ext_resource type="PackedScene" uid="uid://fal1ond30jey" path="res://scenes/units/components/gathering.tscn" id="5_j8w6w"]

View File

@@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ch02ae8fj2lhh" path="res://assets/models/aphid.glb" id="1_cchbm"]
[ext_resource type="Script" path="res://scripts/units/aphid.gd" id="2_ohs5l"]
[ext_resource type="Material" uid="uid://f5ibq3dhugoo" path="res://resources/materials/aphid_material.tres" id="3_dcaja"]
[ext_resource type="Material" uid="uid://f5ibq3dhugoo" path="res://resources/materials/aphid_mat.tres" id="3_dcaja"]
[ext_resource type="Texture2D" uid="uid://duf132faskeid" path="res://assets/textures/selection_unit_hover_decal.png" id="3_wmvub"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_akr28"]

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=17 format=3 uid="uid://ceru75se7ifkb"]
[gd_scene load_steps=15 format=3 uid="uid://ceru75se7ifkb"]
[ext_resource type="PackedScene" uid="uid://brjxxr7h0o0ay" path="res://scenes/static/ground.tscn" id="1_7osoy"]
[ext_resource type="Script" path="res://scripts/main_camera.gd" id="1_gnxhh"]
[ext_resource type="PackedScene" uid="uid://d4c6ujs1ra1ob" path="res://scenes/units/aphid.tscn" id="3_eh22j"]
[ext_resource type="PackedScene" uid="uid://c70rhvk2okkcu" path="res://scenes/ui/buy_ants.tscn" id="4_irvxk"]
[ext_resource type="PackedScene" uid="uid://dhtofjn8dnuw3" path="res://scenes/ui/unit_info.tscn" id="5_asam3"]
[ext_resource type="PackedScene" uid="uid://davys5ol18oyo" path="res://scenes/ui/pause_menu.tscn" id="5_ljrsn"]
@@ -10,22 +10,17 @@
[ext_resource type="PackedScene" uid="uid://d8ut24fit87x" path="res://scenes/ui/anthill_info.tscn" id="8_ohyy4"]
[sub_resource type="NavigationMesh" id="NavigationMesh_6jq54"]
vertices = PackedVector3Array(-2.95696, 0.5, 1.42491, -0.95696, 0.5, -0.0750852, -1.45696, 0.5, -0.325085, -3.20696, 0.5, 0.924915, -7.95696, 0.5, 5.42491, -4.70696, 0.5, 2.17491, -4.70696, 0.5, 1.42491, -7.95696, 0.5, -5.32509, -1.45696, 0.5, -1.07509, -3.70696, 0.5, 5.42491, -3.70696, 0.5, 2.67491, -4.20696, 0.5, 0.924915, -0.70696, 0.5, -5.32509, -0.70696, 0.5, -1.32509, -2.95696, 0.5, 2.42491, -0.20696, 0.5, -0.325085, 12.543, 0.5, -5.32509, -0.20696, 0.5, -1.07509, 12.543, 0.5, 5.42491)
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1), PackedInt32Array(5, 4, 6), PackedInt32Array(6, 4, 7), PackedInt32Array(8, 2, 3), PackedInt32Array(10, 9, 5), PackedInt32Array(5, 9, 4), PackedInt32Array(3, 11, 8), PackedInt32Array(8, 11, 12), PackedInt32Array(12, 13, 8), PackedInt32Array(6, 7, 11), PackedInt32Array(11, 7, 12), PackedInt32Array(9, 10, 14), PackedInt32Array(1, 15, 0), PackedInt32Array(0, 15, 14), PackedInt32Array(15, 17, 16), PackedInt32Array(13, 12, 17), PackedInt32Array(17, 12, 16), PackedInt32Array(14, 15, 9), PackedInt32Array(9, 15, 18), PackedInt32Array(18, 15, 16)]
vertices = PackedVector3Array(-72.472, 0.5, -74.6876, -72.472, 0.5, 74.8124, 77.028, 0.5, 74.8124, 77.028, 0.5, -74.6876)
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)]
agent_height = 0.5
agent_radius = 0.25
[sub_resource type="PlaneMesh" id="PlaneMesh_qt7ar"]
size = Vector2(20.97, 11.275)
size = Vector2(150, 150)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_21sta"]
albedo_color = Color(0.114897, 0.114897, 0.114897, 1)
[sub_resource type="BoxMesh" id="BoxMesh_w7g3k"]
size = Vector3(0.5, 0.5, 0.5)
[sub_resource type="CapsuleMesh" id="CapsuleMesh_2chuy"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_po5ks"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
@@ -35,33 +30,29 @@ sky_material = SubResource("ProceduralSkyMaterial_po5ks")
[sub_resource type="Environment" id="Environment_nnr3k"]
background_mode = 1
background_color = Color(0.547785, 0.658701, 0.745764, 1)
background_color = Color(0.266667, 0.227451, 0.196078, 1)
sky = SubResource("Sky_au5yl")
ambient_light_source = 2
ambient_light_color = Color(0.688926, 0.561215, 0.460104, 1)
[node name="World" type="Node3D"]
[node name="Static" type="Node" parent="."]
[node name="Geometry" type="Node" parent="Static"]
[node name="Ground" parent="Static/Geometry" instance=ExtResource("1_7osoy")]
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="Static"]
navigation_mesh = SubResource("NavigationMesh_6jq54")
[node name="PlaneMesh" type="MeshInstance3D" parent="Static/NavigationRegion3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.27804, 0, 0.0624147)
visible = false
mesh = SubResource("PlaneMesh_qt7ar")
skeleton = NodePath("")
surface_material_override/0 = SubResource("StandardMaterial3D_21sta")
[node name="BoxMesh" type="MeshInstance3D" parent="Static/NavigationRegion3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.731028, 0.25, -0.696817)
mesh = SubResource("BoxMesh_w7g3k")
skeleton = NodePath("")
[node name="BoxMesh2" type="MeshInstance3D" parent="Static/NavigationRegion3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.75856, 0.25, 1.78207)
visible = false
mesh = SubResource("CapsuleMesh_2chuy")
skeleton = NodePath("")
[node name="WorldEnvironment" type="WorldEnvironment" parent="Static"]
environment = SubResource("Environment_nnr3k")
@@ -73,18 +64,6 @@ shadow_enabled = true
[node name="Aphids" type="Node" parent="Units"]
[node name="Aphid" parent="Units/Aphids" instance=ExtResource("3_eh22j")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.62044, -2.38419e-07, -1.07353)
[node name="Aphid2" parent="Units/Aphids" instance=ExtResource("3_eh22j")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.87474, -2.38419e-07, -1.07353)
[node name="Aphid3" parent="Units/Aphids" instance=ExtResource("3_eh22j")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.19235, -2.38419e-07, -1.07353)
[node name="Aphid4" parent="Units/Aphids" instance=ExtResource("3_eh22j")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.19235, -2.38419e-07, -2.63002)
[node name="Nitwits" type="Node" parent="Units"]
[node name="Gatherers" type="Node" parent="Units"]
@@ -92,7 +71,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.19235, -2.38419e-07, -2.63
[node name="Structures" type="Node" parent="."]
[node name="Anthill" parent="Structures" instance=ExtResource("7_f30w3")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.79455, 0, 1.78811)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -58.3389, 0, -63.0179)
[node name="Items" type="Node" parent="."]

View File

@@ -13,6 +13,7 @@ const ZOOM_VALUE_DEFAULT: float = 0.3
## from the screen edge to move the camera.
const EDGE_THRESHOLD: float = 10
const HEADING_SPEED: float = 0.75
const BOUNDARY: float = 150 / 2
@export var zoom_in_distance: float = 5
@export var zoom_in_fov: float = 25
@@ -43,6 +44,10 @@ var window_out_of_focus: bool = false
@onready var anthill: Anthill = $/root/World/Structures/Anthill
func _ready() -> void:
target_position = anthill.global_position
func _process(delta: float) -> void:
_handle_heading_to(delta)
zoom_value = lerp(zoom_value, zoom_raw, delta * ZOOM_DAMP)
@@ -131,6 +136,8 @@ func _handle_movement(delta: float) -> void:
var speed: float = lerp(zoom_in_speed, zoom_out_speed, zoom_value)
var velocity := direction * speed
target_position += velocity * delta
target_position.x = clamp(target_position.x, -BOUNDARY, BOUNDARY)
target_position.z = clamp(target_position.z, -BOUNDARY, BOUNDARY)
func _handle_heading_to(delta: float) -> void: