Skip to content

Commit

Permalink
Pick ray now ignores invisible blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
blackears committed Jan 9, 2024
1 parent 981f5ea commit 5100af7
Show file tree
Hide file tree
Showing 6 changed files with 969 additions and 176 deletions.
3 changes: 3 additions & 0 deletions godot/addons/cyclops_level_builder/cyclops_level_builder.gd
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ func intersect_ray_closest(origin:Vector3, dir:Vector3)->IntersectResults:
var blocks:Array[CyclopsBlock] = get_blocks()

for block in blocks:
if !block.is_visible_in_tree():
continue

var result:IntersectResults = block.intersect_ray_closest(origin, dir)
# print("isect %s %s" % [node.name, result])
if result:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ layout_mode = 2
[node name="check_flatten" type="CheckBox" parent="MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "If unchecked, the scene heierarchy will be refelected in the exported nodes. Otherwise all nodes will be children of the root."
button_pressed = true
text = "Flatten"

[node name="check_markers" type="CheckBox" parent="MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Include Marker3Ds in export."
button_pressed = true
text = "Markers"

Expand Down
3 changes: 2 additions & 1 deletion godot/addons/cyclops_level_builder/tools/tool_edit_edge.gd
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ func start_drag(viewport_camera:Camera3D, event:InputEvent):
GizmoTranslate.Part.PLANE_YZ:
move_constraint = MoveConstraint.Type.PLANE_YZ

drag_handle_start_pos = gizmo_translate.global_position
drag_handle_start_pos = part_res.pos_world
# drag_handle_start_pos = gizmo_translate.global_position
#var grid_step_size:float = pow(2, builder.get_global_scene().grid_size)

#drag_handle_start_pos = MathUtil.snap_to_grid(start_pos, grid_step_size)
Expand Down
5 changes: 3 additions & 2 deletions godot/addons/cyclops_level_builder/tools/tool_edit_face.gd
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,14 @@ func start_drag(viewport_camera:Camera3D, event:InputEvent):
GizmoTranslate.Part.PLANE_YZ:
move_constraint = MoveConstraint.Type.PLANE_YZ

#var start_pos:Vector3 = part_res.pos_world
var start_pos:Vector3 = part_res.pos_world
#var grid_step_size:float = pow(2, builder.get_global_scene().grid_size)

# drag_handle_start_pos = MathUtil.snap_to_grid(start_pos, grid_step_size)
#drag_handle_start_pos = builder.get_snapping_manager().snap_point(start_pos, SnappingQuery.new(viewport_camera))

drag_handle_start_pos = gizmo_translate.global_position
drag_handle_start_pos = start_pos
# drag_handle_start_pos = gizmo_translate.global_position

# print("res obj %s" % result.object.get_path())
var sel_blocks:Array[CyclopsBlock] = builder.get_selected_blocks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func _gui_input(viewport_camera:Camera3D, event:InputEvent)->bool:
var result:IntersectResults = builder.intersect_ray_closest(origin, dir)

if result:
print ("hit ", result.object.name)
cmd.undo_it()
var block:CyclopsBlock = result.object
if settings.individual_faces:
Expand Down
Loading

0 comments on commit 5100af7

Please sign in to comment.