SetNet.Hitscan
1.2.0
dotnet add package SetNet.Hitscan --version 1.2.0
NuGet\Install-Package SetNet.Hitscan -Version 1.2.0
<PackageReference Include="SetNet.Hitscan" Version="1.2.0" />
<PackageVersion Include="SetNet.Hitscan" Version="1.2.0" />
<PackageReference Include="SetNet.Hitscan" />
paket add SetNet.Hitscan --version 1.2.0
#r "nuget: SetNet.Hitscan, 1.2.0"
#:package SetNet.Hitscan@1.2.0
#addin nuget:?package=SetNet.Hitscan&version=1.2.0
#tool nuget:?package=SetNet.Hitscan&version=1.2.0
SetNet.Hitscan
Server-authoritative instant-hit (hitscan) shooting for SetNet — with a fully pluggable hit test.
The whole point is the IHitDetector interface: you decide what a shot hits. Bring your own collision, or compose the shipped detectors.
using SetNet.Hitscan;
// ── bring your own hit test ──────────────────────────────
public sealed class MyDetector : IHitDetector
{
public HitResult Raycast(in Ray ray, in HitQuery query)
{
// cast against YOUR world / entities however you like; return the closest hit or HitResult.Miss
if (MyPhysics.Raycast(ray.Origin, ray.Direction, query.MaxDistance, out var hit, out var id))
return new HitResult(HitKind.Target, hit.Point, hit.Distance, hit.Normal, id, hit.Entity);
return HitResult.Miss;
}
}
var gun = new HitscanResolver(new MyDetector());
gun.OnHit += r => Damage(r.TargetId!, weapon.Damage);
var result = gun.Fire(muzzle, aimDir, shooterId: "player", maxDistance: 80);
Or use the shipped detectors
// sphere targets (your entities) + world geometry, closest wins (a wall blocks a target behind it)
var detector = new CompositeHitDetector(
new TargetHitDetector(myTargetProvider), // ITargetProvider → HitTarget spheres
new GeoDataHitDetector(geo)); // SetNet.GeoData world raycast
var gun = new HitscanResolver(detector);
IHitDetector.Raycast(in Ray, in HitQuery)→HitResult— the seam you implement (or reuse). Returns the closest hit withinHitQuery.MaxDistance, orHitResult.Miss.ITargetProvidersuppliesHitTargetspheres (id + centre + radius + your payload) for the query;TargetHitDetectordoes the ray-vs-sphere.GeoDataHitDetectorwrapsIGeoData.Raycastfor walls/cover.CompositeHitDetectormerges detectors, returning the nearest.HitscanResolveradds ignore-self, default range,OnShot/OnHitevents;Fire(origin, dir, shooterId, maxDistance?, faction?, context?)→HitResult.
HitResult: Hit, Kind (Target/World), Point, Distance, Normal, TargetId, Target (your entity). The same IHitDetector also drives SetNet.Projectiles, so your collision code is reused for both.
Depends on SetNet.GeoData (for Vec3 + IGeoData). No wire — the app broadcasts the result its own way. License: MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- SetNet.GeoData (>= 1.2.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SetNet.Hitscan:
| Package | Downloads |
|---|---|
|
SetNet.Projectiles
Server-authoritative travelling projectiles for SetNet: spawn with a velocity, advance each tick (optional gravity), and sweep-test the path with the SAME pluggable IHitDetector as SetNet.Hitscan — so you bring your own hit detection. Lifetime/range, Hit/Expired events, on-hit callback. Auto-subscribes to SetNet.Ticks (or drive Update(dt) yourself). Depends on SetNet.Hitscan + SetNet.GeoData + SetNet.Ticks. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 124 | 8/5/2026 |