Implement interactive prop handling for StickmanRig
- Added PropTrajectory class for deterministic ballistic calculations. - Introduced StickmanPropInteraction component to manage prop interactions (pickup, drop, throw). - Implemented grip resolution and attachment logic for props. - Added signals for interaction events (prop_picked_up, prop_dropped, prop_thrown). - Defined specifications for prop interaction lifecycle and event rules. - Ensured compatibility with existing prop systems and added new capabilities for prop pickup.
This commit is contained in:
+14
-1
@@ -110,6 +110,7 @@ var _current_path: String = ""
|
||||
var _dirty: bool = false
|
||||
var _clipboard: Dictionary = {}
|
||||
var _anchors: Dictionary = PropAnchorDataScript.default_anchors()
|
||||
var _can_be_picked_up: bool = true
|
||||
var _selected_anchor_id: String = ""
|
||||
var _thumb: PropThumbnail
|
||||
var _thumb_cache: ThumbnailCache
|
||||
@@ -121,6 +122,7 @@ var _material_section: VBoxContainer
|
||||
var _mass_label: Label
|
||||
var _friction_label: Label
|
||||
var _bounce_label: Label
|
||||
var _can_be_picked_up_check: CheckBox
|
||||
var _fill_button: ColorPickerButton
|
||||
var _outline_button: ColorPickerButton
|
||||
var _width_spin: SpinBox
|
||||
@@ -790,6 +792,8 @@ func _do_new() -> void:
|
||||
_set_whole_prop_resize_enabled(false)
|
||||
_prop_name_edit.text = ""
|
||||
_material_preset = PropBlockScript.MaterialPreset.NONE
|
||||
_can_be_picked_up = true
|
||||
if _can_be_picked_up_check != null: _can_be_picked_up_check.button_pressed = true
|
||||
_preset_option.selected = _material_preset
|
||||
_update_physics_labels()
|
||||
_canvas.clear()
|
||||
@@ -855,6 +859,13 @@ func _build_inspector() -> void:
|
||||
_material_section.add_child(_mass_label)
|
||||
_material_section.add_child(_friction_label)
|
||||
_material_section.add_child(_bounce_label)
|
||||
_can_be_picked_up_check = CheckBox.new()
|
||||
_can_be_picked_up_check.text = "Can be picked up"
|
||||
_can_be_picked_up_check.button_pressed = _can_be_picked_up
|
||||
_can_be_picked_up_check.toggled.connect(func(enabled: bool) -> void:
|
||||
_can_be_picked_up = enabled
|
||||
_mark_dirty())
|
||||
_material_section.add_child(_can_be_picked_up_check)
|
||||
_update_physics_labels()
|
||||
|
||||
# Selected-shape section
|
||||
@@ -1454,7 +1465,7 @@ func _check_autosave_recovery() -> void:
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
func _build_json_data() -> Dictionary:
|
||||
return PropFileScript.to_file_dict(_prop_name_edit.text, _material_preset, _canvas.get_shape_data(), _anchors)
|
||||
return PropFileScript.to_file_dict(_prop_name_edit.text, _material_preset, _canvas.get_shape_data(), _anchors, _can_be_picked_up)
|
||||
|
||||
|
||||
func _apply_json_data(json: Variant, is_recovery: bool = false) -> String:
|
||||
@@ -1465,6 +1476,8 @@ func _apply_json_data(json: Variant, is_recovery: bool = false) -> String:
|
||||
return "The file could not be read: unsupported version or malformed data."
|
||||
_prop_name_edit.text = str(model.get("prop_name", ""))
|
||||
_material_preset = int(model.get("material_preset", PropBlockScript.MaterialPreset.NONE))
|
||||
_can_be_picked_up = bool(model.get("can_be_picked_up", true))
|
||||
if _can_be_picked_up_check != null: _can_be_picked_up_check.button_pressed = _can_be_picked_up
|
||||
if _preset_option != null:
|
||||
_preset_option.selected = _material_preset
|
||||
_update_physics_labels()
|
||||
|
||||
Reference in New Issue
Block a user