Home

Awesome

Unity3d Physics Gun Sample

The goal of this sample is to show an implementation of the "Physics Gun" behavior from Half-Life 2 / Garry's Mod / GMod.

Video about the creation of this repo, thoughts and reasons behind can be seen here.

alt text

Get started

"PhysicsGunInteractionBehavior.cs" is the script you are looking for. This is the script that does most of the actual logic, however, we encourage you to download the entire project and look at the "PhysicsGunSampleScene" as there are more to it than just the behavior.

Works with Unity v2020.2.2f1

Todo: "If somebody want to write a guide to get started, feel free to do a PR."

Originally the "GravityGun" script in this repo, is based on this script: https://pastebin.com/w1G8m3dH

Contribute

The point of creating this repo was to have a place where the Unity3d community could collaborate on this "Physics Gun"-script. So please optimize, add features, fix bugs and send a Pull-Request - I'll be happy to look at it :)