Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change camera for the backpack avatar preview when change wearable #34

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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