Godot 4+ C# / .NET v1.1 — MIT 3D Physics

BZ Godot
Physics

A lightweight C# physics helper for Godot 4+. Clean extension methods for 3D raycasting — less boilerplate, more game.

Get Started View on GitHub
PlayerController.cs
using BZ.Physics;

// Cast a ray downward to check if grounded
CastHit hit = this.CastRay3D(
    from: GlobalPosition,
    direction: -GlobalBasis.Y,
    distance: 1.1f,
    layerMask: PhysicsHelper.GetCollisionMask(1)
);

if (hit.NonEmpty)
{
    GD.Print($"Hit {hit.ColliderOwnerName}");
}

Everything you need.
Nothing you don't.

A minimal, focused API that feels native to Godot's C# workflow.

🎯

Easy Raycasting

Extension methods on Node3D for raycasts and linecasts. No boilerplate, no PhysicsDirectSpaceState setup required.

📦

Structured Results

The CastHit readonly struct gives you clean access to position, normal, collider, RID, and owner name.

🎭

Collision Masks

Generate bitfield masks with GetCollisionMask(1, 3, 5) using intuitive 1-based layer numbers.

Minimal Footprint

A single static utility class. Zero dependencies beyond Godot itself. Adds no runtime overhead to your project.

🔌

Asset Library Ready

Available via the Godot Asset Library for one-click install, or drop the folder in manually — your choice.

🌐

Area3D Support

Optional collideWithAreas flag on both cast methods to detect trigger volumes alongside physics bodies.

Full API

All public members of the BZ.Physics namespace.

CastHit — readonly struct
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.
PhysicsHelper — static extension methods
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).

Get it running
in minutes.

Two installation paths — pick the one that fits your workflow.

1
Open your Godot project and navigate to the AssetLib tab at the top of the editor.
2
Search for BZ Godot Physics and click Install.
3
Go to Project → Project Settings → Plugins and enable BZPhysicsHelper.
4
Add using BZ.Physics; at the top of any script and you're ready to go.
1
Clone or download this repository from GitHub.
2
Copy the addons/BZPhysicsHelper folder into your project's addons/ directory.
3
Enable the plugin via Project → Project Settings → Plugins.
4
Add using BZ.Physics; to your scripts and start casting.

Requirements

✓  Godot 4.0 or later ✓  .NET-enabled Godot build ✓  Basic C# knowledge ✓  3D project

Built for ease of use.

🧍

Ground Detection

Cast rays downward to determine if a character is grounded before applying jump force.

👁️

Line of Sight

Check visibility between two actors for AI awareness, stealth systems, or fog of war.

🔫

Hitscan Weapons

Instant hit detection for guns or projectile systems without spawning physics objects.

🚧

Obstacle Detection

Probe a character's path for obstacles to trigger AI avoidance or movement decisions.