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:
+16
-1
@@ -11,6 +11,7 @@ extends RigidBody2D
|
||||
## friction/bounce (PhysicsMaterial), and themed visuals.
|
||||
|
||||
const PropVisuals := preload("res://scripts/prop_visuals.gd")
|
||||
const PropAnchorData := preload("res://scripts/prop_anchor_data.gd")
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Enums
|
||||
@@ -22,6 +23,11 @@ enum MaterialPreset { NONE, WOOD, RUBBER, CARDBOARD, METAL }
|
||||
|
||||
## Stable library provenance used by Sandbox Stage scene files.
|
||||
var spawn_id: String = ""
|
||||
## Runtime interaction metadata. Both values are additive so existing scenes
|
||||
## and built-in templates remain pickup-enabled.
|
||||
var can_be_picked_up: bool = true
|
||||
var anchors: Dictionary = PropAnchorData.default_anchors()
|
||||
var held_by_instance_id: int = 0
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Child node names
|
||||
@@ -275,7 +281,16 @@ func has_custom_shapes() -> bool:
|
||||
|
||||
|
||||
func get_visual_local_bounds() -> Rect2:
|
||||
return _visual_local_bounds
|
||||
if _custom_shapes:
|
||||
return _visual_local_bounds
|
||||
if shape_type == ShapeType.CIRCLE:
|
||||
return Rect2(Vector2.ONE * -radius, Vector2.ONE * radius * 2.0)
|
||||
if not polygon_points.is_empty():
|
||||
var bounds: Rect2 = Rect2(polygon_points[0], Vector2.ZERO)
|
||||
for point: Vector2 in polygon_points:
|
||||
bounds = bounds.expand(point)
|
||||
return bounds
|
||||
return Rect2()
|
||||
|
||||
## RigidBody2D transforms do not reliably retain scale during simulation. Move
|
||||
## the authored uniform scale into child visuals and collision geometry for
|
||||
|
||||
Reference in New Issue
Block a user