Skip to content

Commit

Permalink
feat: change camera for the backpack avatar preview when change weara…
Browse files Browse the repository at this point in the history
…ble (#34)
  • Loading branch information
Mateo Miccino authored Aug 15, 2023
1 parent f73e9be commit 103d955
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions godot/src/ui/components/backpack/avatar_preview.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ var start_dragging_position
var dirty_is_dragging


func focus_camera_on(type):
var tween = create_tween()
match type:
Wearables.Categories.HAIR, Wearables.Categories.FACIAL_HAIR, Wearables.Categories.EYEWEAR, Wearables.Categories.TIARA, Wearables.Categories.FACIAL, Wearables.Categories.EYEBROWS, Wearables.Categories.MOUTH, Wearables.Categories.HAT, Wearables.Categories.EARRING, Wearables.Categories.MASK, Wearables.Categories.HELMET, Wearables.Categories.TOP_HEAD, Wearables.Categories.EYES:
tween.tween_property(camera_3d, "position", Vector3(0, 1.68, -0.523), 0.5)
_:
tween.tween_property(camera_3d, "position", Vector3(0, 0.957, -1.623), 0.5)
tween.play()


func _on_gui_input(event):
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT:
Expand Down
1 change: 1 addition & 0 deletions godot/src/ui/components/backpack/backpack.gd
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func _on_wearable_toggled(_button_toggled: bool, wearable_id: String) -> void:

func _on_wearable_button_filter_type(type):
load_filtered_data(type)
avatar_preview.focus_camera_on(type)

var should_hide = false
if type == Wearables.Categories.BODY_SHAPE:
Expand Down

0 comments on commit 103d955

Please sign in to comment.