generated from krampus/template-godot4
Flag marker shows distance to goal
This commit is contained in:
parent
ec9b7e6f83
commit
361e51d714
|
@ -13,7 +13,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://dagh38vap4t1d" path="res://src/scenery/city/concrete_building_1.tscn" id="10_lf15j"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjubxs7peir5k" path="res://src/scenery/city/kana_signboard.tscn" id="11_evxup"]
|
||||
[ext_resource type="PackedScene" uid="uid://di7aql54lksn7" path="res://src/scenery/trees/palm_tree/palm_tree.tscn" id="12_sswxf"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7l58wuuahn7w" path="res://src/props/flag.tscn" id="13_6jtao"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7l58wuuahn7w" path="res://src/props/flag/flag.tscn" id="13_6jtao"]
|
||||
[ext_resource type="Texture2D" uid="uid://dj60e8ri2fco" path="res://assets/models/scenery/city/concrete_building_1/concrete_building_1.png" id="14_y7s2h"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_rpgb7"]
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
@tool
|
||||
extends Node3D
|
||||
|
||||
@export var show_distance: bool:
|
||||
set(value):
|
||||
if distance_label:
|
||||
distance_label.visible = value
|
||||
get:
|
||||
return distance_label.visible
|
||||
@onready var distance_label: Label3D = %DistanceLabel
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if show_distance:
|
||||
var viewport := get_viewport()
|
||||
if viewport:
|
||||
var camera := viewport.get_camera_3d()
|
||||
if camera:
|
||||
var distance := int(global_position.distance_to(camera.global_position))
|
||||
distance_label.text = "Goal!\n%d m" % distance
|
|
@ -1,11 +1,35 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://c7l58wuuahn7w"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c7l58wuuahn7w"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dqj60gh364mn5" path="res://assets/models/course/flag/flag.gltf" id="1_ona6u"]
|
||||
[ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="2_tmki0"]
|
||||
[ext_resource type="Script" path="res://src/props/flag/flag.gd" id="2_wv8rd"]
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_8ynho"]
|
||||
data = PackedVector3Array(0, 0, -0.025, 0.0217, 4, -0.0125, 0, 4, -0.025, 0, 0, -0.025, 0.0217, 0, -0.0125, 0.0217, 4, -0.0125, 0.0217, 0, -0.0125, 0.0217, 4, 0.0125, 0.0217, 4, -0.0125, 0.0217, 0, -0.0125, 0.0217, 0, 0.0125, 0.0217, 4, 0.0125, 0.0217, 0, 0.0125, 0, 4, 0.025, 0.0217, 4, 0.0125, 0.0217, 0, 0.0125, 0, 0, 0.025, 0, 4, 0.025, 0, 0, 0.025, -0.0217, 4, 0.0125, 0, 4, 0.025, 0, 0, 0.025, -0.0217, 0, 0.0125, -0.0217, 4, 0.0125, 0.0217, 4, 0.0125, 0, 4, -0.025, 0.0217, 4, -0.0125, 0, 4, -0.025, -0.0217, 4, 0.0125, -0.0217, 4, -0.0125, -0.0217, 4, 0.0125, 0.0217, 4, 0.0125, 0, 4, 0.025, 0, 4, -0.025, 0.0217, 4, 0.0125, -0.0217, 4, 0.0125, -0.0217, 0, 0.0125, -0.0217, 4, -0.0125, -0.0217, 4, 0.0125, -0.0217, 0, 0.0125, -0.0217, 0, -0.0125, -0.0217, 4, -0.0125, -0.0217, 0, -0.0125, 0, 4, -0.025, -0.0217, 4, -0.0125, -0.0217, 0, -0.0125, 0, 0, -0.025, 0, 4, -0.025, -0.0217, 0, -0.0125, 0.0217, 0, -0.0125, 0, 0, -0.025, 0.0217, 0, -0.0125, 0, 0, 0.025, 0.0217, 0, 0.0125, 0, 0, 0.025, -0.0217, 0, -0.0125, -0.0217, 0, 0.0125, 0.0217, 0, -0.0125, -0.0217, 0, -0.0125, 0, 0, 0.025)
|
||||
|
||||
[node name="Flag" instance=ExtResource("1_ona6u")]
|
||||
script = ExtResource("2_wv8rd")
|
||||
show_distance = true
|
||||
|
||||
[node name="DistanceLabel" type="Label3D" parent="Pole" index="0"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0)
|
||||
visibility_range_begin = 20.0
|
||||
visibility_range_begin_margin = 2.0
|
||||
visibility_range_fade_mode = 1
|
||||
pixel_size = 0.001
|
||||
billboard = 1
|
||||
no_depth_test = true
|
||||
fixed_size = true
|
||||
texture_filter = 5
|
||||
render_priority = 3
|
||||
outline_render_priority = 2
|
||||
outline_modulate = Color(1, 0, 0.133333, 1)
|
||||
text = "Goal!
|
||||
0000 m"
|
||||
font = ExtResource("2_tmki0")
|
||||
outline_size = 8
|
||||
line_spacing = -16.0
|
||||
|
||||
[node name="Skeleton3D" parent="Armature" index="0"]
|
||||
bones/0/rotation = Quaternion(-0.0471389, 2.3332e-10, 0.0444053, 0.997901)
|
Loading…
Reference in New Issue