BallisticSolutions.Godot 6.1.0

dotnet add package BallisticSolutions.Godot --version 6.1.0
                    
NuGet\Install-Package BallisticSolutions.Godot -Version 6.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BallisticSolutions.Godot" Version="6.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BallisticSolutions.Godot" Version="6.1.0" />
                    
Directory.Packages.props
<PackageReference Include="BallisticSolutions.Godot" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BallisticSolutions.Godot --version 6.1.0
                    
#r "nuget: BallisticSolutions.Godot, 6.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BallisticSolutions.Godot@6.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BallisticSolutions.Godot&version=6.1.0
                    
Install as a Cake Addin
#tool nuget:?package=BallisticSolutions.Godot&version=6.1.0
                    
Install as a Cake Tool

BallisticSolutions (C#)


Table of Contents

  1. Installation & Dependencies
  2. Example
  3. Reference

Installation & Dependencies

Two packages are available depending on your project type:

Package Vector types
BallisticSolutions System.Numerics.Vector*
BallisticSolutions.Godot Godot.Vector*

Installation

Search for package in the NuGet manager.

Or add to your .csproj:


<ItemGroup>
  <PackageReference Include="BallisticSolutions" Version="*" />
</ItemGroup>


<ItemGroup>
  <PackageReference Include="BallisticSolutions.Godot" Version="*" />
</ItemGroup>
Option 2: DLL (Godot addon)

Add to your .csproj:

<ItemGroup>
  <Reference Include="BallisticSolutions.Godot">
    <HintPath>addons\BallisticSolutions.Godot\BallisticSolutions.Godot.dll</HintPath>
  </Reference>
  <Reference Include="MathNet.Numerics">
    <HintPath>addons\BallisticSolutions.Godot\MathNet.Numerics.dll</HintPath>
  </Reference>
</ItemGroup>

Dependencies

BallisticSolutions.Godot:


Example

using Godot;
using BallisticSolutions.Godot.BsSolvers.BsVelocity;

// ...

	[Export]
	public PackedScene ProjectileScene { get; set; }

	[Export]
	public float ProjectileSpeed { get; set; } = 200;

	[Export]
	public Vector2 ProjectileAcceleration { get; set; }

	public void Shoot(Target2D target) {
		Vector2 toTarget = target.GlobalPosition - GlobalPosition;

		Vector2 velocity = BsVelocity2D.Best(
			ProjectileSpeed,
			toTarget,
			target.Velocity,
			ProjectileAcceleration,
			target.Acceleration
		);

		if (float.IsNaN(velocity.X)) {
			GD.Print("Impossible to hit the target");
			return;
		}

		var newProjectile = ProjectileScene.Instantiate<Projectile2D>();
		newProjectile.GlobalPosition = GlobalPosition;
		newProjectile.Velocity = velocity;
		newProjectile.Acceleration = ProjectileAcceleration;

		GetParent().AddChild(newProjectile);
	}

Reference

For the complete documentation, refer to the generated XML documentation.

*D suffix denotes 2D, 3D, or 4D variants — BsTime*D stands for BsTime2D, BsTime3D, and BsTime4D. Each variant uses the corresponding Vector* type (Vector2, Vector3, Vector4). All variants share the same API.

  1. BsSolution<T>
  2. BsSolution*D
  3. BsPosition*D
  4. BsTime*D
  5. BsVelocity*D

BsSolution<T>

Abstract base class representing a ballistic solution. T is a floating-point numeric type (e.g., float, double).

Property Type Description
Time T Interception time.
Position Vector* Impact position relative to the projectile origin.
DistanceToPosition float Distance to the impact position.
DirectionToPosition Vector* Direction to the impact position.
ProjectileVelocity Vector* Required firing velocity.
ProjectileSpeed float Projectile speed.
ProjectileDirection Vector* Projectile direction.
ToTarget Vector* Vector from shooter to target at t = 0.
DistanceToTarget float Distance to target at t = 0.
DirectionToTarget Vector* Direction to target at t = 0.
TargetVelocity Vector* Target velocity at t = 0.
TargetSpeed float Target speed.
TargetDirection Vector* Target direction.
ProjectileAcceleration Vector* Projectile acceleration.
TargetAcceleration Vector* Target acceleration.

BsSolution*D

BsSolution*D<T>? Best<T>(float projectileSpeed, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the earliest valid solution, or null if interception is impossible.


BsSolution*D<T>? Best<T>(Vector* projectileDirection, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the earliest valid solution, or null if interception is impossible.


BsSolution*D<T>[] All<T>(float projectileSpeed, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: all valid solutions sorted by interception time. Empty array if impossible.


BsSolution*D<T>[] All<T>(Vector* projectileDirection, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: all valid solutions sorted by interception time. Empty array if impossible.


BsPosition*D

Vector* Displacement<T>(T time, Vector* velocity, Vector* acceleration = default)

Returns: displacement under constant acceleration.


Vector* Position<T>(Vector* position, T time, Vector* velocity, Vector* acceleration = default)

Returns: position after elapsed time under constant acceleration.


Vector* Best(float projectileSpeed, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the earliest valid impact position. Returns a NaN vector if impossible.


Vector* Best(Vector* projectileDirection, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the earliest valid impact position. Returns a NaN vector if impossible.


Vector*[] All(float projectileSpeed, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: all valid impact positions. Empty array if impossible.


Vector*[] All(Vector* projectileDirection, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: all valid impact positions. Empty array if impossible.


BsTime*D

T Best<T>(float projectileSpeed, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the earliest interception time (t ≥ 0). Returns NaN if impossible.


T Best<T>(Vector* projectileDirection, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the earliest interception time (t ≥ 0). Returns NaN if impossible.


T[] All<T>(float projectileSpeed, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: all valid interception times sorted ascending. Empty array if impossible.


T[] All<T>(Vector* projectileDirection, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: all valid interception times sorted ascending. Empty array if impossible.


BsVelocity*D

Vector* Velocity<T>(T time, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the firing velocity required to hit the target at the given time.


Vector* Best(float projectileSpeed, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the earliest valid firing velocity. Returns a NaN vector if impossible.


Vector* Best(Vector* projectileDirection, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: the earliest valid firing velocity. Returns a NaN vector if impossible.


Vector*[] All(float projectileSpeed, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: all valid firing velocities. Empty array if impossible.


Vector*[] All(Vector* projectileDirection, Vector* toTarget, Vector* targetVelocity = default, Vector* projectileAcceleration = default, Vector* targetAcceleration = default)

Returns: all valid firing velocities. Empty array if impossible.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.1.0 110 6/27/2026
6.0.3 107 6/24/2026