A lightweight C# physics helper for Godot 4+. Clean extension methods for 3D raycasting — less boilerplate, more game.
A minimal, focused API that feels native to Godot's C# workflow.
Extension methods on Node3D for raycasts and linecasts. No boilerplate, no PhysicsDirectSpaceState setup required.
The CastHit readonly struct gives you clean access to position, normal, collider, RID, and owner name.
Generate bitfield masks with GetCollisionMask(1, 3, 5) using intuitive 1-based layer numbers.
A single static utility class. Zero dependencies beyond Godot itself. Adds no runtime overhead to your project.
Available via the Godot Asset Library for one-click install, or drop the folder in manually — your choice.
Optional collideWithAreas flag on both cast methods to detect trigger volumes alongside physics bodies.
All public members of the BZ.Physics namespace.
| Property | Type | Description |
|---|---|---|
| NonEmpty | bool | True if the cast intersected with something. |
| HitPosition | Vector3 | World-space position of the intersection point. |
| Normal | Vector3 | Surface normal at the hit point. |
| Collider | CollisionObject3D | Reference to the collider that was hit. |
| ColliderId | uint | Instance ID of the collider. |
| Rid | Rid | Low-level resource ID of the collider. |
| ColliderOwnerName | string | Name of the collider's owner node. |
| Method | Returns | Description |
|---|---|---|
| CastRay3D(from, direction, distance, layerMask?, collideWithAreas?) | CastHit | Raycast from a point in a direction for a set distance. Extension on Node3D. |
| CastLine3D(from, to, layerMask?, collideWithAreas?) | CastHit | Linecast between two world-space points. Extension on Node3D. |
| GetCollisionMask(params layers) | uint | Builds a collision bitfield from 1-based layer numbers. E.g. GetCollisionMask(1, 3, 5). |
Two installation paths — pick the one that fits your workflow.
BZ Godot Physics and click Install.Project → Project Settings → Plugins and enable BZPhysicsHelper.using BZ.Physics; at the top of any script and you're ready to go.addons/BZPhysicsHelper folder into your project's addons/ directory.Project → Project Settings → Plugins.using BZ.Physics; to your scripts and start casting.Requirements
Cast rays downward to determine if a character is grounded before applying jump force.
Check visibility between two actors for AI awareness, stealth systems, or fog of war.
Instant hit detection for guns or projectile systems without spawning physics objects.
Probe a character's path for obstacles to trigger AI avoidance or movement decisions.