Skip to content

Weapons

The Weapon component turns a grabbable into a real weapon: it hits a target, and the server decides the damage — so a modified client can't fake a kill. It handles the feel (recoil, muzzle flash, haptics) locally and sends only a fire request; the server validates the rate of fire, the range, and that the shot actually points at the target before applying damage to a player or a Health object.

Set it up

  1. Make the gun grabbable — add an Interactable (Mode = Grab), and usually a Grab Pose so it sits right in the hand. (Adding Weapon adds the Interactable for you.)
  2. Add Weapon (Social Scape/Weapon). Point Muzzle at a small child transform at the barrel tip, facing forward (+Z) — shots leave from there. Empty = the object's own pivot.

That's the whole setup. A held weapon fires by itself — there is no "fire" event to wire. On desktop, pick it up and hold left-click; in VR, pull the trigger. Picking the weapon up arms it; Fire Rate caps how fast it shoots.

Weapon settings

Field What it does Default
Muzzle Where shots originate + aim from. this object
Damage Damage per hit (the server clamps it to a max). 25
Fire Rate Shots per second (rate-limited server-side too). 6
Range How far a hitscan shot reaches (m). 100
Radius 0 = hitscan (a precise beam). > 0 = area/explosive damage with linear falloff — a grenade, rocket. 0
Hit Mask Which layers a shot can hit. Everything
Recoil Anchor / Kickback / Pitch / Recovery Visual kick when it fires and how fast it settles. 0.03 / 4° / recover 12
Muzzle Flash / Muzzle Light A ParticleSystem / Light pulsed on each shot.
Fire Haptic The haptic clip on fire. Shot
On Fire A UnityEvent fired on each shot (sound, ejection, animation).

Damage is never decided on your machine

The weapon only requests damage; the server validates fire rate, muzzle proximity, range, and hit direction, then clamps the amount and applies it. That's what makes it cheat-resistant — you author feel, the server owns outcomes.

Pump / rack feel — Weapon Slide

Add Weapon Slide (Social Scape/Weapon Slide) for a pump shotgun, a bolt, or a charging handle. It animates a slide back-and-forward and fires an On Rack event at the chambering point — a presentation hook (play the rack sound, eject a shell). It does not gate firing.

Field What it does Default
Slide The transform that slides. this object
Travel How far it moves (local). (0, 0, -0.05)
Cycle Time Seconds for the full back-and-forward. 0.18
On Rack Fired at the chamber point of the cycle.

For a slide the player physically racks by hand (not a button), use a Slider / Constrained interactable and its OnRackCycle() callback instead.

Examples

A server-authoritative pistol

Grabbable + Grab Pose + Weapon (Damage 25, Radius 0). Pick it up and pull the trigger (VR) or hold left-click (desktop) — no event wiring. Shoot a Health barrel and the server applies the damage; the barrel's On Death response spawns debris.

A grenade launcher

Weapon with Radius 2 — everything within 2 m of the hit takes falloff damage.

A pump shotgun (feel only)

Weapon + Weapon Slide (or a hand-racked Slider) gives the pump animation and sound. Note: there is no built-in ammo or chamber gating yet — On Rack and On Fire are presentation hooks, not a fire veto, so the pump is currently cosmetic (the weapon still fires on Fire Rate alone).