Compare commits
No commits in common. "240e9f72165b47d868fbb7df4a71bdfa37c35952" and "5d76a0bbf7a2e773282b2f0821f3b1586ace53ad" have entirely different histories.
240e9f7216
...
5d76a0bbf7
6 changed files with 55 additions and 134 deletions
12
UI/hover.gd
12
UI/hover.gd
|
@ -1,12 +0,0 @@
|
||||||
extends Control
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
var mouse = get_viewport().get_mouse_position() + Vector2(25,10) #magic number
|
|
||||||
position = mouse
|
|
|
@ -1 +0,0 @@
|
||||||
uid://c3jwnn1dj2tg5
|
|
|
@ -1,10 +1,9 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://c7hu51a2omayl"]
|
[gd_scene load_steps=6 format=3 uid="uid://c7hu51a2omayl"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c6xp0y6y0gnjt" path="res://core/scripts/player_interface.gd" id="1_nbn0p"]
|
[ext_resource type="Script" uid="uid://c6xp0y6y0gnjt" path="res://core/scripts/player_interface.gd" id="1_nbn0p"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dtnvfhpg0fmlk" path="res://packs/Kenney-cursors/Outline/steps.svg" id="1_ur0rc"]
|
[ext_resource type="Texture2D" uid="uid://dtnvfhpg0fmlk" path="res://packs/Kenney-cursors/Outline/steps.svg" id="1_ur0rc"]
|
||||||
[ext_resource type="Script" uid="uid://bxo7f7f1th34m" path="res://core/scripts/player_selection_manager.gd" id="3_u7fvt"]
|
[ext_resource type="Script" uid="uid://bxo7f7f1th34m" path="res://core/scripts/player_selection_manager.gd" id="3_u7fvt"]
|
||||||
[ext_resource type="StyleBox" uid="uid://nn1eq5h68x1b" path="res://ui/selection_rect_style.tres" id="4_u7fvt"]
|
[ext_resource type="StyleBox" uid="uid://nn1eq5h68x1b" path="res://ui/selection_rect_style.tres" id="4_u7fvt"]
|
||||||
[ext_resource type="Script" uid="uid://c3jwnn1dj2tg5" path="res://ui/hover.gd" id="5_fvvd0"]
|
|
||||||
|
|
||||||
[sub_resource type="Theme" id="Theme_ur0rc"]
|
[sub_resource type="Theme" id="Theme_ur0rc"]
|
||||||
|
|
||||||
|
@ -20,7 +19,6 @@ pivot_offset = Vector2(960, 540)
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
accessibility_name = "Player interface"
|
|
||||||
script = ExtResource("1_nbn0p")
|
script = ExtResource("1_nbn0p")
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="."]
|
[node name="Button" type="Button" parent="."]
|
||||||
|
@ -37,19 +35,10 @@ theme = SubResource("Theme_ur0rc")
|
||||||
text = "Test Button"
|
text = "Test Button"
|
||||||
icon = ExtResource("1_ur0rc")
|
icon = ExtResource("1_ur0rc")
|
||||||
|
|
||||||
[node name="SelectionManager" type="Control" parent="." node_paths=PackedStringArray("hover")]
|
[node name="SelectionManager" type="Control" parent="."]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
process_priority = -1
|
process_priority = -1
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
script = ExtResource("3_u7fvt")
|
script = ExtResource("3_u7fvt")
|
||||||
hover = NodePath("../HoverLabel")
|
|
||||||
rect_style = ExtResource("4_u7fvt")
|
rect_style = ExtResource("4_u7fvt")
|
||||||
|
|
||||||
[node name="HoverLabel" type="Label" parent="."]
|
|
||||||
editor_description = "Control that displayed the hovered informations"
|
|
||||||
top_level = true
|
|
||||||
layout_mode = 0
|
|
||||||
offset_right = 40.0
|
|
||||||
offset_bottom = 23.0
|
|
||||||
script = ExtResource("5_fvvd0")
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ transform = Transform3D(-4.37114e-08, 0.573576, -0.819152, 0, 0.819152, 0.573576
|
||||||
|
|
||||||
[node name="camera_player" type="Camera3D" parent="camera_rot/camera_point"]
|
[node name="camera_player" type="Camera3D" parent="camera_rot/camera_point"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5)
|
|
||||||
|
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
mesh = SubResource("SphereMesh_ipmo0")
|
mesh = SubResource("SphereMesh_ipmo0")
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
class_name SelectionManager
|
class_name SelectionManager
|
||||||
|
|
||||||
@export_category("Controls")
|
|
||||||
@export var hover:Control
|
|
||||||
@export_category("Settings")
|
|
||||||
@export var rect_style: StyleBoxFlat
|
|
||||||
|
|
||||||
var draw_selection := false
|
var draw_selection := false
|
||||||
var drag_start: Vector2
|
var drag_start: Vector2
|
||||||
var select_box: Rect2
|
var select_box: Rect2
|
||||||
var perform_selection := false # Flag to trigger selection in _physics_process
|
var perform_selection := false # Flag to trigger selection in _physics_process
|
||||||
var mouse_position:Vector2 # Storing mous eposition to use it on differents processes
|
|
||||||
@onready var box_color: Color = ProjectSettings.get_setting("game/interface/selection_rectangle_color", Color("#00ff0066"))
|
@onready var box_color: Color = ProjectSettings.get_setting("game/interface/selection_rectangle_color", Color("#00ff0066"))
|
||||||
@onready var box_color_outline: Color = ProjectSettings.get_setting("game/interface/selection_rectangle_color_outline", Color("#00ff00"))
|
@onready var box_color_outline: Color = ProjectSettings.get_setting("game/interface/selection_rectangle_color_outline", Color("#00ff00"))
|
||||||
@onready var optimized_rect: bool = ProjectSettings.get_setting("game/interface/optimized_rectangle", false)
|
@onready var optimized_rect: bool = ProjectSettings.get_setting("game/interface/optimized_rectangle", false)
|
||||||
|
@export var rect_style: StyleBoxFlat
|
||||||
@onready var cam = get_viewport().get_camera_3d()
|
@onready var cam = get_viewport().get_camera_3d()
|
||||||
@onready var selecteddisplay: Button = $"../Button"
|
@onready var hovercontrol:Button = $"../Button"
|
||||||
@onready var debug_mode = get_tree().debug_collisions_hint #ProjectSettings.get_setting("debug/collisions/show_mouse_trace", false)
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if optimized_rect:return
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(e: InputEvent) -> void:
|
func _unhandled_input(e: InputEvent) -> void:
|
||||||
|
@ -27,6 +24,7 @@ func _unhandled_input(e: InputEvent) -> void:
|
||||||
draw_selection = true
|
draw_selection = true
|
||||||
drag_start = e.position
|
drag_start = e.position
|
||||||
else:
|
else:
|
||||||
|
# When button is released
|
||||||
draw_selection = false
|
draw_selection = false
|
||||||
if drag_start.is_equal_approx(e.position):
|
if drag_start.is_equal_approx(e.position):
|
||||||
# Single click: set a zero-sized selection box
|
# Single click: set a zero-sized selection box
|
||||||
|
@ -37,11 +35,10 @@ func _unhandled_input(e: InputEvent) -> void:
|
||||||
var x_min = min(drag_start.x, e.position.x)
|
var x_min = min(drag_start.x, e.position.x)
|
||||||
var y_min = min(drag_start.y, e.position.y)
|
var y_min = min(drag_start.y, e.position.y)
|
||||||
select_box = Rect2(x_min, y_min,
|
select_box = Rect2(x_min, y_min,
|
||||||
max(drag_start.x, e.position.x) - x_min,
|
max(drag_start.x, e.position.x) - x_min,
|
||||||
max(drag_start.y, e.position.y) - y_min)
|
max(drag_start.y, e.position.y) - y_min)
|
||||||
|
|
||||||
perform_selection = true
|
|
||||||
|
|
||||||
|
perform_selection = true # Trigger selection in _physics_process
|
||||||
queue_redraw()
|
queue_redraw()
|
||||||
elif draw_selection and e is InputEventMouseMotion:
|
elif draw_selection and e is InputEventMouseMotion:
|
||||||
# Update selection box for drawing during drag
|
# Update selection box for drawing during drag
|
||||||
|
@ -53,38 +50,29 @@ func _unhandled_input(e: InputEvent) -> void:
|
||||||
|
|
||||||
queue_redraw()
|
queue_redraw()
|
||||||
if !draw_selection and e is InputEventMouseMotion:
|
if !draw_selection and e is InputEventMouseMotion:
|
||||||
mouse_position = e.position
|
check_hover()
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
if perform_selection:
|
if perform_selection:
|
||||||
update_selected_units()
|
update_selected_units()
|
||||||
perform_selection = false
|
perform_selection = false
|
||||||
else:
|
|
||||||
check_hover(mouse_position)
|
|
||||||
|
|
||||||
|
|
||||||
func check_hover(mouse_pos:Vector2):
|
func check_hover():
|
||||||
# TODO: Hovering and display names
|
# TODO: Hovering and display names
|
||||||
var raycast = check_raycast(mouse_pos)
|
|
||||||
if raycast.is_empty():
|
|
||||||
hover.text = ""
|
|
||||||
elif raycast.collider:
|
|
||||||
var hovered_entity = raycast.collider.get_parent()
|
|
||||||
hover.text = hovered_entity.name
|
|
||||||
|
|
||||||
var selected = get_selected()
|
var selected = get_selected()
|
||||||
if selected.size() > 0:
|
if selected.size() > 0:
|
||||||
selecteddisplay.text = selected[0].name
|
hovercontrol.text = selected[0].name
|
||||||
else:
|
else:
|
||||||
selecteddisplay.text = ""
|
hovercontrol.text = ""
|
||||||
|
|
||||||
selecteddisplay.queue_redraw()
|
hovercontrol.queue_redraw()
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
## Returns an array of entities selected by the player, using multiplayer-unique group names
|
|
||||||
func get_selected() -> Array[Entity]:
|
func get_selected() -> Array[Entity]:
|
||||||
var selected: Array[Node] = get_tree().get_nodes_in_group('selected-by-' + str(get_tree().get_multiplayer().get_unique_id()))
|
var selected: Array[Node] = get_tree().get_nodes_in_group('selected-by-'+str(get_tree().get_multiplayer().get_unique_id()))
|
||||||
var selected_entity: Array[Entity]
|
var selected_entity: Array[Entity]
|
||||||
selected_entity.assign(selected)
|
selected_entity.assign(selected)
|
||||||
return selected_entity
|
return selected_entity
|
||||||
|
@ -98,41 +86,29 @@ func check_raycast(mouse_pos: Vector2, collision_mask: int = 32768) -> Dictionar
|
||||||
query.collide_with_areas = true
|
query.collide_with_areas = true
|
||||||
query.collide_with_bodies = false
|
query.collide_with_bodies = false
|
||||||
var space_state = cam.get_world_3d().direct_space_state
|
var space_state = cam.get_world_3d().direct_space_state
|
||||||
if space_state:
|
#DebugTools.DrawLine(from,to,25.0)
|
||||||
return space_state.intersect_ray(query)
|
return space_state.intersect_ray(query)
|
||||||
|
|
||||||
return {}
|
|
||||||
|
|
||||||
|
|
||||||
## Deselects all currently selected entities
|
|
||||||
func deselect_all() -> void:
|
func deselect_all() -> void:
|
||||||
var selected = get_selected()
|
var selected = get_selected()
|
||||||
for entity: Entity in selected:
|
for entity:Entity in selected:
|
||||||
entity.deselect()
|
entity.deselect()
|
||||||
|
|
||||||
|
|
||||||
## Updates selection state of entities based on single-click (raycast) or drag (box) selection [br]
|
|
||||||
## Iterate on every entities inside the [param selectable-entity] group
|
|
||||||
func update_selected_units() -> void:
|
func update_selected_units() -> void:
|
||||||
## FIXME: Could be optimized if we store an array of visible entity by adding[br]
|
|
||||||
## an [Area3D] child of the camera OR changing the group based on if the 3d model is loaded
|
|
||||||
var units_array = get_tree().get_nodes_in_group("selectable-entity")
|
var units_array = get_tree().get_nodes_in_group("selectable-entity")
|
||||||
var raycast = {}
|
var raycast = {}
|
||||||
# Only perform raycast if it's a single click (zero-sized select_box)
|
# Only perform raycast if it's a single click (zero-sized select_box)
|
||||||
if select_box.size == Vector2.ZERO:
|
if select_box.size == Vector2.ZERO:
|
||||||
raycast = check_raycast(select_box.position)
|
raycast = check_raycast(select_box.position,)
|
||||||
if raycast.is_empty():
|
if raycast and raycast.collider:
|
||||||
deselect_all()
|
|
||||||
return
|
|
||||||
if raycast.collider:
|
|
||||||
if debug_mode:
|
|
||||||
DebugTools.DrawCube(raycast.position,0.02,3.0,Color())
|
|
||||||
|
|
||||||
# select entity under mouse
|
# select entity under mouse
|
||||||
# maybe can be extracted from hover instead?
|
# maybe can be extracted from hover instead?
|
||||||
var entity = raycast.collider.get_parent()
|
var entity = raycast.collider.get_parent()
|
||||||
deselect_all()
|
deselect_all()
|
||||||
entity.select()
|
entity.select()
|
||||||
|
# BUG: Deselect previous selection
|
||||||
return
|
return
|
||||||
for entity: Entity in units_array:
|
for entity: Entity in units_array:
|
||||||
# TODO: Optimize by searching only in spawned chunks
|
# TODO: Optimize by searching only in spawned chunks
|
||||||
|
@ -143,7 +119,6 @@ func update_selected_units() -> void:
|
||||||
entity.deselect()
|
entity.deselect()
|
||||||
|
|
||||||
|
|
||||||
## Draws the selection rectangle during drag or selection, using optimized or styled rendering
|
|
||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
if not (draw_selection or perform_selection):return
|
if not (draw_selection or perform_selection):return
|
||||||
if select_box and rect_style:
|
if select_box and rect_style:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
extends Control
|
extends Control
|
||||||
## A utility node for drawing 3D debug visuals (lines, rays, cubes) in screen space.
|
|
||||||
@export var MouseOverlay: Node
|
@export var MouseOverlay: Node
|
||||||
@onready var Cam = get_viewport().get_camera_3d()
|
@onready var Cam = get_viewport().get_camera_3d()
|
||||||
|
|
||||||
|
@ -8,52 +7,36 @@ extends Control
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if !OS.is_debug_build():
|
if !OS.is_debug_build():
|
||||||
self.queue_free()
|
self.queue_free()
|
||||||
return
|
|
||||||
|
|
||||||
# Ensure the node processes and draws even when the game is paused.
|
|
||||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
|
||||||
# Ensure the node is visible and set to draw in screen space.
|
|
||||||
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
||||||
|
|
||||||
|
|
||||||
## A class representing a single debug line with start/end points, color, and duration.
|
|
||||||
class Line:
|
class Line:
|
||||||
var Start:Vector3
|
var Start:Vector3
|
||||||
var End:Vector3
|
var End:Vector3
|
||||||
var LineColor:Color
|
var LineColor:Color
|
||||||
var time:float
|
var time
|
||||||
|
|
||||||
|
|
||||||
## Constructor for DebugLine. [br]
|
func _init(Start:Vector3, End:Vector3, LineColor, time):
|
||||||
## [param _start] Starting point in 3D space.[br]
|
self.Start = Start
|
||||||
## [param _end] Ending point in 3D space.[br]
|
self.End = End
|
||||||
## [param _color] Color of the line.[br]
|
self.LineColor = LineColor
|
||||||
## [param _time] Duration the line persists (seconds).
|
self.time = time
|
||||||
func _init(_Start:Vector3, _End:Vector3, _LineColor:Color, _time:float):
|
|
||||||
self.Start = _Start
|
|
||||||
self.End = _End
|
|
||||||
self.LineColor = _LineColor
|
|
||||||
self.time = _time
|
|
||||||
|
|
||||||
## Array storing all active debug lines.
|
|
||||||
var Lines = []
|
var Lines = []
|
||||||
## Flag to track if a line was removed, triggering a redraw.
|
|
||||||
var RemovedLine = false
|
var RemovedLine = false
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
for i in range(len(Lines)):
|
for i in range(len(Lines)):
|
||||||
Lines[i].time -= delta
|
Lines[i].time -= delta
|
||||||
# Trigger a redraw if lines exist or a line was removed.
|
|
||||||
if (len(Lines) > 0 || RemovedLine):
|
if (len(Lines) > 0 || RemovedLine):
|
||||||
queue_redraw() #Calls _draw
|
queue_redraw() #Calls _draw
|
||||||
RemovedLine = false
|
RemovedLine = false
|
||||||
|
|
||||||
|
|
||||||
func _draw():
|
func _draw():
|
||||||
# Exit early if no lines to draw or camera is not available.
|
|
||||||
if Lines.is_empty() or not Cam:
|
|
||||||
return
|
|
||||||
for i in range(len(Lines)):
|
for i in range(len(Lines)):
|
||||||
if Lines[i].Start.length() == 0:return
|
if Lines[i].Start.length() == 0:return
|
||||||
var ScreenPointStart = Cam.unproject_position(Lines[i].Start)
|
var ScreenPointStart = Cam.unproject_position(Lines[i].Start)
|
||||||
|
@ -78,69 +61,57 @@ func _draw():
|
||||||
i -= 1
|
i -= 1
|
||||||
|
|
||||||
|
|
||||||
## Draws a line between two 3D points. [br]
|
## start point, end point, color, time (optional)
|
||||||
## [param start] Starting point in 3D space.[br]
|
func DrawLine(Start, End, time = 0.0, LineColor = Color(1.0, 0.0, 0.0, 1.0)):
|
||||||
## [param end] Ending point in 3D space.[br]
|
|
||||||
## [param time] Duration the line persists (seconds, default: 0.0 for one frame).[br]
|
|
||||||
## [param color] Color of the line (default: red, fully opaque).
|
|
||||||
func DrawLine(Start, End, time := 0.0, LineColor := Color(1.0, 0.0, 0.0, 1.0)):
|
|
||||||
Lines.append(Line.new(Start, End, LineColor, time))
|
Lines.append(Line.new(Start, End, LineColor, time))
|
||||||
|
|
||||||
|
|
||||||
## Draws a ray from a starting point in a given direction.[br]
|
## start point, velocity (direction and magnitude), color, time (optional)
|
||||||
## [param start] Starting point in 3D space.[br]
|
func DrawRay(Start, Ray, time = 0.0, LineColor = Color(1.0, 0.0, 0.0, 1.0)):
|
||||||
## [param ray] Direction and magnitude of the ray (Vector3).[br]
|
|
||||||
## [param time] Duration the ray persists (seconds, default: 0.0 for one frame).[br]
|
|
||||||
## [param color] Color of the ray (default: red, fully opaque).
|
|
||||||
func DrawRay(Start, Ray, time := 0.0, LineColor := Color(1.0, 0.0, 0.0, 1.0)):
|
|
||||||
Lines.append(Line.new(Start, Start + Ray, LineColor, time))
|
Lines.append(Line.new(Start, Start + Ray, LineColor, time))
|
||||||
|
|
||||||
|
|
||||||
## Draws a wireframe cube in 3D space.[br]
|
## start point, half extents (float), color, time (optional)
|
||||||
## [param center] Center point of the cube in 3D space.[br]
|
func DrawCube(Center, HalfExtents, time = 0.0, LineColor = Color(1.0, 0.0, 0.0, 1.0)):
|
||||||
## [param half_extents] Half the width of the cube (default: 0.1).[br]
|
|
||||||
## [param time] Duration the cube persists (seconds, default: 0.0 for one frame).[br]
|
|
||||||
## [param color] Color of the cube's edges (default: red, fully opaque).
|
|
||||||
func DrawCube(Center, HalfExtents := 0.1, time := 0.0, LineColor := Color(1.0, 0.0, 0.0, 1.0)):
|
|
||||||
#Start at the 'top left'
|
#Start at the 'top left'
|
||||||
var LinePointStart = Center
|
var LinePointStart = Center
|
||||||
LinePointStart.x -= HalfExtents
|
LinePointStart.x -= HalfExtents
|
||||||
LinePointStart.y += HalfExtents
|
LinePointStart.y += HalfExtents
|
||||||
LinePointStart.z -= HalfExtents
|
LinePointStart.z -= HalfExtents
|
||||||
|
|
||||||
# Draw top square (four edges).
|
#Draw top square
|
||||||
var LinePointEnd = LinePointStart + Vector3(0, 0, HalfExtents * 2.0)
|
var LinePointEnd = LinePointStart + Vector3(0, 0, HalfExtents * 2.0)
|
||||||
DrawLine(LinePointStart, LinePointEnd, time, LineColor);
|
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||||
LinePointStart = LinePointEnd
|
LinePointStart = LinePointEnd
|
||||||
LinePointEnd = LinePointStart + Vector3(HalfExtents * 2.0, 0, 0)
|
LinePointEnd = LinePointStart + Vector3(HalfExtents * 2.0, 0, 0)
|
||||||
DrawLine(LinePointStart, LinePointEnd, time, LineColor);
|
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||||
LinePointStart = LinePointEnd
|
LinePointStart = LinePointEnd
|
||||||
LinePointEnd = LinePointStart + Vector3(0, 0, -HalfExtents * 2.0)
|
LinePointEnd = LinePointStart + Vector3(0, 0, -HalfExtents * 2.0)
|
||||||
DrawLine(LinePointStart, LinePointEnd, time, LineColor);
|
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||||
LinePointStart = LinePointEnd
|
LinePointStart = LinePointEnd
|
||||||
LinePointEnd = LinePointStart + Vector3(-HalfExtents * 2.0, 0, 0)
|
LinePointEnd = LinePointStart + Vector3(-HalfExtents * 2.0, 0, 0)
|
||||||
DrawLine(LinePointStart, LinePointEnd, time, LineColor);
|
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||||
|
|
||||||
# Draw bottom square (four edges).
|
#Draw bottom square
|
||||||
LinePointStart = LinePointEnd + Vector3(0, -HalfExtents * 2.0, 0)
|
LinePointStart = LinePointEnd + Vector3(0, -HalfExtents * 2.0, 0)
|
||||||
LinePointEnd = LinePointStart + Vector3(0, 0, HalfExtents * 2.0)
|
LinePointEnd = LinePointStart + Vector3(0, 0, HalfExtents * 2.0)
|
||||||
DrawLine(LinePointStart, LinePointEnd, time, LineColor);
|
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||||
LinePointStart = LinePointEnd
|
LinePointStart = LinePointEnd
|
||||||
LinePointEnd = LinePointStart + Vector3(HalfExtents * 2.0, 0, 0)
|
LinePointEnd = LinePointStart + Vector3(HalfExtents * 2.0, 0, 0)
|
||||||
DrawLine(LinePointStart, LinePointEnd, time, LineColor);
|
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||||
LinePointStart = LinePointEnd
|
LinePointStart = LinePointEnd
|
||||||
LinePointEnd = LinePointStart + Vector3(0, 0, -HalfExtents * 2.0)
|
LinePointEnd = LinePointStart + Vector3(0, 0, -HalfExtents * 2.0)
|
||||||
DrawLine(LinePointStart, LinePointEnd, time, LineColor);
|
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||||
LinePointStart = LinePointEnd
|
LinePointStart = LinePointEnd
|
||||||
LinePointEnd = LinePointStart + Vector3(-HalfExtents * 2.0, 0, 0)
|
LinePointEnd = LinePointStart + Vector3(-HalfExtents * 2.0, 0, 0)
|
||||||
DrawLine(LinePointStart, LinePointEnd, time, LineColor);
|
DrawLine(LinePointStart, LinePointEnd, LineColor, time);
|
||||||
|
|
||||||
# Draw vertical lines (four edges connecting top and bottom squares).
|
#Draw vertical lines
|
||||||
LinePointStart = LinePointEnd
|
LinePointStart = LinePointEnd
|
||||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0),time, LineColor)
|
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), LineColor, time)
|
||||||
LinePointStart += Vector3(0, 0, HalfExtents * 2.0)
|
LinePointStart += Vector3(0, 0, HalfExtents * 2.0)
|
||||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), time, LineColor)
|
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), LineColor, time)
|
||||||
LinePointStart += Vector3(HalfExtents * 2.0, 0, 0)
|
LinePointStart += Vector3(HalfExtents * 2.0, 0, 0)
|
||||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), time, LineColor)
|
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), LineColor, time)
|
||||||
LinePointStart += Vector3(0, 0, -HalfExtents * 2.0)
|
LinePointStart += Vector3(0, 0, -HalfExtents * 2.0)
|
||||||
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), time, LineColor)
|
DrawRay(LinePointStart, Vector3(0, HalfExtents * 2.0, 0), LineColor, time)
|
||||||
|
|
Loading…
Reference in a new issue