- Added an icon to the bug marker.
- Bug marker position now updates on every process frame. - Updated licence document to include CC4 icons for bug reports.
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://crr6cjploetps"]
|
||||
|
||||
[ext_resource type="ArrayMesh" uid="uid://dtvea38mlpfla" path="res://addons/Bugbot/Meshes/arrow.res" id="1_65xos"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_v6jy1"]
|
||||
shading_mode = 0
|
||||
billboard_mode = 1
|
||||
billboard_keep_scale = true
|
||||
[ext_resource type="Material" uid="uid://dkaq0ok73o5d4" path="res://addons/Bugbot/Materials/bug_marker_icon.material" id="3_px2dp"]
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_dd1nc"]
|
||||
material = SubResource("StandardMaterial3D_v6jy1")
|
||||
material = ExtResource("3_px2dp")
|
||||
custom_aabb = AABB(-0.25, -0.25, -0.25, 0.5, 0.5, 0.5)
|
||||
size = Vector2(0.25, 0.25)
|
||||
|
||||
[node name="BugMarker" type="Node3D"]
|
||||
|
||||
[node name="Arrow" type="MeshInstance3D" parent="."]
|
||||
cast_shadow = 0
|
||||
mesh = ExtResource("1_65xos")
|
||||
|
||||
[node name="Billboard" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0)
|
||||
cast_shadow = 0
|
||||
mesh = SubResource("QuadMesh_dd1nc")
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
extends Node3D
|
||||
|
||||
enum BugStatus { UNRESOLVED, IN_PROGRESS, RESOLVED }
|
||||
@export var marker_status : BugStatus
|
||||
const UNRESOLVED_COLOUR = Color(0.1, 0.0, 0.0)
|
||||
const IN_PROGRESS_COLOUR = Color(0.5, 0.5, 0.0)
|
||||
const RESOLVED_COLOUR = Color(0.0, 0.1, 0.0)
|
||||
|
||||
@export var follow_node : Node3D
|
||||
|
||||
|
||||
func _process(_delta:float) -> void:
|
||||
if not visible:
|
||||
position = Vector3(0.0, 0.0, 0.0)
|
||||
elif follow_node:
|
||||
global_position = follow_node.global_position
|
||||
|
||||
func set_rotation_to_normal(_normal:Vector3):
|
||||
global_transform.basis.y = _normal
|
||||
global_transform.basis.x = global_transform.basis.z.cross(_normal)
|
||||
global_transform.basis = global_transform.basis.orthonormalized()
|
||||
+8
-10
@@ -1,6 +1,12 @@
|
||||
class_name Bugbot
|
||||
extends CharacterBody3D
|
||||
|
||||
## A controllable bot that marks the location of a bug, and allows writing a bug
|
||||
## report for it.
|
||||
|
||||
## Distance from camera to allow placing bug markers.
|
||||
@export_range(0.0, 100.0, 0.01, "or_greater", "suffix:m") var ray_length : float = 10.0
|
||||
|
||||
@export_group("Inputs")
|
||||
@export_subgroup("Keyboard")
|
||||
@export var keyboard_move_forward : InputEventKey
|
||||
@@ -60,8 +66,6 @@ var stored_mouse_mode : int = Input.MOUSE_MODE_CAPTURED
|
||||
var stored_pause_status : bool = false
|
||||
var raycast_collision : Dictionary
|
||||
|
||||
var _previous_bug_marker_position : Vector3
|
||||
|
||||
|
||||
static func instantiate(tree:SceneTree) -> void:
|
||||
tree.root.add_child(load("res://addons/Bugbot/Scenes/bugbot_player.tscn").instantiate() as CharacterBody3D)
|
||||
@@ -262,7 +266,7 @@ func _on_exit_placement_timer_timeout() -> void:
|
||||
|
||||
func _raycast_to_world():
|
||||
var space : PhysicsDirectSpaceState3D = get_world_3d().direct_space_state
|
||||
var query : PhysicsRayQueryParameters3D = PhysicsRayQueryParameters3D.create(global_position, global_position - global_transform.basis.z * 25.0)
|
||||
var query : PhysicsRayQueryParameters3D = PhysicsRayQueryParameters3D.create(global_position, global_position - global_transform.basis.z * ray_length)
|
||||
query.collide_with_areas = false
|
||||
query.collide_with_bodies = true
|
||||
query.exclude = [get_rid()]
|
||||
@@ -278,13 +282,7 @@ func _raycast_to_world():
|
||||
|
||||
func _place_dummy_marker():
|
||||
if raycast_collision:
|
||||
var collision_point : Vector3 = raycast_collision["position"]
|
||||
var collision_normal : Vector3 = raycast_collision["normal"]
|
||||
bug_marker.global_position = collision_point
|
||||
_previous_bug_marker_position = bug_marker.global_position
|
||||
bug_marker.global_transform.basis.y = collision_normal
|
||||
bug_marker.global_transform.basis.x = bug_marker.global_transform.basis.z.cross(collision_normal)
|
||||
bug_marker.global_transform.basis = bug_marker.global_transform.basis.orthonormalized()
|
||||
bug_marker.set_rotation_to_normal(raycast_collision["normal"])
|
||||
bug_marker.visible = true
|
||||
else:
|
||||
bug_marker.visible = false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=40 format=3 uid="uid://dvgain3s4xa4r"]
|
||||
[gd_scene load_steps=41 format=3 uid="uid://dvgain3s4xa4r"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/Bugbot/Scenes/bugbot_player.gd" id="1_kdrpa"]
|
||||
[ext_resource type="InputEventKey" uid="uid://di5q6d4wt12et" path="res://addons/Bugbot/Inputs/Keyboard/move_forward.res" id="2_jfhdw"]
|
||||
@@ -33,26 +33,28 @@
|
||||
[ext_resource type="InputEventJoypadButton" uid="uid://biuae513qxxf2" path="res://addons/Bugbot/Inputs/Joystick/speed_down.res" id="31_t01c7"]
|
||||
[ext_resource type="InputEventJoypadButton" uid="uid://bc2q8kry856bq" path="res://addons/Bugbot/Inputs/Joystick/place_marker.res" id="32_q7vmk"]
|
||||
[ext_resource type="InputEventJoypadButton" uid="uid://8tu5a8nlxgsj" path="res://addons/Bugbot/Inputs/Joystick/exit_placement.res" id="33_lwr38"]
|
||||
[ext_resource type="Material" uid="uid://c8b630nfapp8l" path="res://addons/Bugbot/Textures/laser_glow.material" id="34_18wde"]
|
||||
[ext_resource type="PackedScene" uid="uid://crr6cjploetps" path="res://addons/Bugbot/Scenes/bug_marker.tscn" id="34_jyjbc"]
|
||||
[ext_resource type="Material" uid="uid://dewbda2gd8bgv" path="res://addons/Bugbot/Textures/laser_glare.material" id="35_f65w0"]
|
||||
[ext_resource type="Script" path="res://addons/Bugbot/Scenes/bug_marker_dummy.gd" id="35_ibing"]
|
||||
[ext_resource type="Material" uid="uid://c8b630nfapp8l" path="res://addons/Bugbot/Materials/laser_glow.material" id="35_xqv41"]
|
||||
[ext_resource type="Material" uid="uid://dewbda2gd8bgv" path="res://addons/Bugbot/Materials/laser_glare.material" id="36_e4bro"]
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_ts4fq"]
|
||||
material = ExtResource("34_18wde")
|
||||
material = ExtResource("35_xqv41")
|
||||
top_radius = 0.005
|
||||
bottom_radius = 0.005
|
||||
height = 1.0
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_kvipo"]
|
||||
material = ExtResource("35_f65w0")
|
||||
material = ExtResource("36_e4bro")
|
||||
size = Vector2(0.25, 0.25)
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_6gwao"]
|
||||
radius = 0.25
|
||||
|
||||
[node name="BugbotPlayer" type="CharacterBody3D"]
|
||||
process_mode = 3
|
||||
collision_layer = 4294967295
|
||||
collision_mask = 0
|
||||
collision_layer = 0
|
||||
collision_mask = 4294967295
|
||||
input_ray_pickable = false
|
||||
motion_mode = 1
|
||||
platform_on_leave = 2
|
||||
@@ -91,7 +93,9 @@ joypad_movement_speed_down = ExtResource("31_t01c7")
|
||||
joypad_place_marker = ExtResource("32_q7vmk")
|
||||
joypad_exit_placement = ExtResource("33_lwr38")
|
||||
|
||||
[node name="BugMarker" parent="." instance=ExtResource("34_jyjbc")]
|
||||
[node name="BugMarker" parent="." node_paths=PackedStringArray("follow_node") instance=ExtResource("34_jyjbc")]
|
||||
script = ExtResource("35_ibing")
|
||||
follow_node = NodePath("../LaserBeamRoot/LaserGlare")
|
||||
|
||||
[node name="LaserBeamRoot" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.5, -0.5, 0)
|
||||
|
||||
Reference in New Issue
Block a user