Thunder.UnitsNET.Vectors

Unit-aware 2D/3D vector types for physics-driven game loops. Component types come from UnitsNet, so every operation preserves physical units — LengthVector2 / Duration returns SpeedVector2, not a raw float.

Packages

Package Description
NuGet Thunder.UnitsNET.Vectors Core vector types: position, velocity, force, …
NuGet Thunder.UnitsNET.Vectors.MonoGame MonoGame/XNA conversion helpers
NuGet Thunder.UnitsNET.Vectors.Geometry Unit-aware 2D geometry shapes
NuGet Thunder.UnitsNET.Vectors.Geometry.MonoGame Geometry → MonoGame rendering primitives

See the API Reference for the full type inventory.

Quick start

using Thunder.UnitsNET.Vectors;
using UnitsNet;

// Position
var position = new LengthVector2(Length.FromMeters(3), Length.FromMeters(4));

// Kinematics: displacement / time → velocity
SpeedVector2 velocity = position / Duration.FromSeconds(2);

// Dynamics: F = ma
var accel = new AccelerationVector2(
    Acceleration.FromMetersPerSecondSquared(9.8),
    Acceleration.FromMetersPerSecondSquared(0));
ForceVector2 force = accel * Mass.FromKilograms(5);

// Dot product: work = F · d (returns Energy)
Energy work = force.Dot(position);

💻 Source

latest ▼