update root unit node to CharacterBody3D and fix selection logic

This commit is contained in:
2024-10-06 01:37:16 +10:00
parent 326877f384
commit a6fb508151
4 changed files with 8 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/ant.glb-2bc83283752a3a739ab3e737bef4a96c.scn"
[params]
nodes/root_type="StaticBody3D"
nodes/root_type="CharacterBody3D"
nodes/root_name="TestUnit"
nodes/apply_root_scale=true
nodes/root_scale=1.0

View File

@@ -1,5 +1,6 @@
[gd_scene load_steps=4 format=3 uid="uid://cfixshlmwhpmi"]
[gd_scene load_steps=5 format=3 uid="uid://cfixshlmwhpmi"]
[ext_resource type="Script" path="res://scripts/units/test_unit.gd" id="1_e76lg"]
[ext_resource type="PackedScene" uid="uid://bi231xk2sp410" path="res://assets/models/ant.glb" id="1_ff64u"]
[ext_resource type="Texture2D" uid="uid://dehqm00kiljut" path="res://assets/textures/selection_unit_decal.png" id="2_5725f"]
@@ -7,6 +8,7 @@
radius = 0.25
[node name="TestUnit" instance=ExtResource("1_ff64u")]
script = ExtResource("1_e76lg")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." index="2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0)
@@ -17,3 +19,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0021804, 0.00953716, -0.00
pixel_size = 0.0055
axis = 1
texture = ExtResource("2_5725f")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="." index="4"]

View File

@@ -97,7 +97,7 @@ func _on_frustrum_area_unit_entered(unit: Node3D) -> void:
if visible_units.keys().has(unit_id):
return
visible_units[unit_id] = unit.get_parent()
visible_units[unit_id] = unit
func _on_frustrum_area_unit_exited(unit: Node3D) -> void:

View File

@@ -1,4 +1,4 @@
extends Node3D
extends CharacterBody3D
class_name TestUnit
var selected: bool = false