Merge remote-tracking branch 'origin/destroy-player' into GameGui

This commit is contained in:
Walter
2026-01-31 23:22:16 -06:00
+7
View File
@@ -17,6 +17,7 @@ public class PlayerPickupController : MonoBehaviour
[SerializeField] private float throwChargeTime = 0.75f; [SerializeField] private float throwChargeTime = 0.75f;
[SerializeField] private float throwUpwardForce = 0f; [SerializeField] private float throwUpwardForce = 0f;
[SerializeField] private float throwTriggerThreshold = 0.6f; [SerializeField] private float throwTriggerThreshold = 0.6f;
[SerializeField] private float dropClearance = 0.2f;
[Header("Setup")] [Header("Setup")]
public Transform holdPoint; // Empty GameObject above head public Transform holdPoint; // Empty GameObject above head
@@ -165,6 +166,11 @@ public class PlayerPickupController : MonoBehaviour
{ {
heldPickup.enabled = false; heldPickup.enabled = false;
} }
if (heldObject.TryGetComponent<Rigidbody2D>(out var heldBody))
{
heldBody.linearVelocity = Vector2.zero;
heldBody.angularVelocity = 0f;
}
} }
if (col != null) col.enabled = false; if (col != null) col.enabled = false;
@@ -214,6 +220,7 @@ public class PlayerPickupController : MonoBehaviour
throwBody.linearVelocity = new Vector2(direction * throwSpeed, 0f); throwBody.linearVelocity = new Vector2(direction * throwSpeed, 0f);
throwBody.angularVelocity = 0f; throwBody.angularVelocity = 0f;
} }
heldObject.transform.position += Vector3.up * dropClearance;
Collider2D col = heldObject.GetComponent<Collider2D>(); Collider2D col = heldObject.GetComponent<Collider2D>();
if (col != null) col.enabled = true; if (col != null) col.enabled = true;