Script — Gravity Gun
if (Input.GetButton("Fire2")) // Right click hold: Pull object toward you { if (!isHolding) PullObject(); }
Here’s a compact (Unity/C#) that lets you pick up, hold, and launch rigidbody objects with realistic force. It’s designed for a first-person controller and works like the Half-Life 2 gravity gun. Gravity gun script
if (isHolding && heldObject != null) { // Move held object to hold point Vector3 targetPos = holdPoint.position; heldObject.velocity = (targetPos - heldObject.position) * pullForce; if (Input