generated from krampus/template-godot4
Fixed tool positioning issues
This commit is contained in:
parent
75b5a2e30c
commit
c092fd1097
@ -7,6 +7,7 @@
|
||||
[node name="LaserCast" type="RayCast3D"]
|
||||
target_position = Vector3(0, 0, -2)
|
||||
collision_mask = 4
|
||||
hit_from_inside = true
|
||||
script = ExtResource("1_xntcr")
|
||||
|
||||
[node name="LaserDust" parent="." instance=ExtResource("2_m5xmf")]
|
||||
|
@ -34,7 +34,8 @@ func idle() -> void:
|
||||
_idle()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
func _physics_process(delta: float) -> void:
|
||||
if hud_tool:
|
||||
var weight := clampf(HUD_ACCEL * delta, 0.0, 1.0)
|
||||
hud_tool.global_basis = global_basis
|
||||
hud_tool.global_position = hud_tool.global_position.lerp(global_position, HUD_ACCEL * delta)
|
||||
hud_tool.global_position = hud_tool.global_position.lerp(global_position, weight)
|
||||
|
@ -12,6 +12,8 @@ const BRUSH_SCALE := 0.2
|
||||
@onready var texture_used: TextureRect = %TextureUsed
|
||||
@onready var brush_animation: AnimationPlayer = %BrushAnimation
|
||||
|
||||
@onready var resting_position: Marker3D = %RestingPosition
|
||||
|
||||
|
||||
func _fire() -> void:
|
||||
if raycast.is_colliding() and not Game.manager.is_tank_full():
|
||||
@ -36,3 +38,13 @@ func _fire() -> void:
|
||||
func _idle() -> void:
|
||||
texture_idle.visible = true
|
||||
texture_used.visible = false
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
hud_tool.global_basis = global_basis
|
||||
|
||||
var weight := clampf(HUD_ACCEL * delta, 0.0, 1.0)
|
||||
var target_position := resting_position.global_position
|
||||
if raycast.is_colliding():
|
||||
target_position = raycast.get_collision_point()
|
||||
hud_tool.global_position = hud_tool.global_position.lerp(target_position, weight)
|
||||
|
@ -10,7 +10,7 @@ length = 0.001
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:x")
|
||||
tracks/0/path = NodePath("RestingPosition/HUDTool/CanvasProjector/HUDElement/Pivot/TextureUsed:position:x")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
@ -21,7 +21,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:y")
|
||||
tracks/1/path = NodePath("RestingPosition/HUDTool/CanvasProjector/HUDElement/Pivot/TextureUsed:position:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@ -37,7 +37,7 @@ loop_mode = 1
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:x")
|
||||
tracks/0/path = NodePath("RestingPosition/HUDTool/CanvasProjector/HUDElement/Pivot/TextureUsed:position:x")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
@ -48,7 +48,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:y")
|
||||
tracks/1/path = NodePath("RestingPosition/HUDTool/CanvasProjector/HUDElement/Pivot/TextureUsed:position:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@ -72,16 +72,21 @@ unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 0.997564, -0.0697565, 0, 0.0697565, 0.997564, 0, 0, -0.15)
|
||||
target_position = Vector3(0, 0, -1)
|
||||
collision_mask = 4
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="HUDTool" type="Node3D" parent="."]
|
||||
[node name="RestingPosition" type="Marker3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2)
|
||||
|
||||
[node name="HUDTool" type="Node3D" parent="RestingPosition"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2)
|
||||
top_level = true
|
||||
|
||||
[node name="NozzleMarker" type="Marker3D" parent="HUDTool"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2)
|
||||
[node name="CanvasProjector" type="Marker3D" parent="RestingPosition/HUDTool"]
|
||||
script = ExtResource("2_awr0g")
|
||||
|
||||
[node name="HUDElement" type="Control" parent="HUDTool/NozzleMarker"]
|
||||
[node name="HUDElement" type="Control" parent="RestingPosition/HUDTool/CanvasProjector"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
@ -91,14 +96,14 @@ anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Pivot" type="Control" parent="HUDTool/NozzleMarker/HUDElement"]
|
||||
[node name="Pivot" type="Control" parent="RestingPosition/HUDTool/CanvasProjector/HUDElement"]
|
||||
anchors_preset = 0
|
||||
offset_left = -200.0
|
||||
offset_top = -256.0
|
||||
offset_right = -200.0
|
||||
offset_bottom = -256.0
|
||||
offset_left = -64.0
|
||||
offset_top = -128.0
|
||||
offset_right = -64.0
|
||||
offset_bottom = -128.0
|
||||
|
||||
[node name="TextureIdle" type="TextureRect" parent="HUDTool/NozzleMarker/HUDElement/Pivot"]
|
||||
[node name="TextureIdle" type="TextureRect" parent="RestingPosition/HUDTool/CanvasProjector/HUDElement/Pivot"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
@ -107,7 +112,7 @@ offset_bottom = 128.0
|
||||
scale = Vector2(5, 5)
|
||||
texture = ExtResource("3_sxute")
|
||||
|
||||
[node name="TextureUsed" type="TextureRect" parent="HUDTool/NozzleMarker/HUDElement/Pivot"]
|
||||
[node name="TextureUsed" type="TextureRect" parent="RestingPosition/HUDTool/CanvasProjector/HUDElement/Pivot"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
texture_filter = 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user