Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/fixedmathsharp.git

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **FixedMathSharp** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/fixedmathsharp.git
```

[![pkglnk](https://www.pkglnk.dev/badge/fixedmathsharp.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/fixedmathsharp)

README

FixedMathSharp-Unity

==============

FixedMathSharp Icon

A deterministic fixed-point math library for Unity and .NET, designed for lockstep simulation, multiplayer determinism, and floating-point-free precision.

This package is a Unity-specific implementation of the FixedMathSharp library


🛠️ Key Features

  • Fully Deterministic – Eliminates floating-point errors for lockstep simulations.
  • Fixed-Point Arithmetic – Implements Fixed64 with high precision.
  • Math & Trigonometry – Optimized FixedMath and FixedTrigonometry utilities.
  • Vector & Matrix Support – Includes Vector2d, Vector3d, FixedQuaternion, and Fixed4x4.
  • Bounding Volume Utilities – Use BoundingBox, BoundingSphere, and BoundingArea for collision checks.
  • Unity Integration – Compatible with Unity’s Job System & Burst Compiler.
  • Full Serialization Support: Out-of-the-box round-trip serialization via MemoryPack across all serializable structs.

🚀 Installation

Via Unity Package Manager (UPM)

  1. Open Unity Package Manager (Window > Package Manager).
  2. Click Add package from git URL....
  3. Enter:

https://github.com/mrdav30/FixedMathSharp-Unity.git

Manual Import

  1. Download the latest FixedMathSharp.unitypackage from the Releases.
  2. In Unity, go to Assets > Import Package > Custom Package....
  3. Select and import FixedMathSharp.unitypackage.

đź“– Usage Examples

Basic Arithmetic with Fixed64

Fixed64 a = new Fixed64(1.5);
Fixed64 b = new Fixed64(2.5);
Fixed64 result = a + b;
Console.WriteLine(result); // Output: 4.0

Vector Operations

Vector3d v1 = new Vector3d(1, 2, 3);
Vector3d v2 = new Vector3d(4, 5, 6);
Fixed64 dotProduct = Vector3d.Dot(v1, v2);
Console.WriteLine(dotProduct); // Output: 32

Quaternion Rotation

FixedQuaternion rotation = FixedQuaternion.FromAxisAngle(Vector3d.Up, FixedMath.PiOver2); // 90 degrees around Y-axis
Vector3d point = new Vector3d(1, 0, 0);
Vector3d rotatedPoint = rotation.Rotate(point);
Console.WriteLine(rotatedPoint); // Output: (0, 0, -1)

Matrix Transformations

Fixed4x4 matrix = Fixed4x4.Identity;
Vector3d position = new Vector3d(1, 2, 3);
matrix.SetTransform(position, Vector3d.One, FixedQuaternion.Identity);
Console.WriteLine(matrix);

Bounding Shapes and Intersection

BoundingBox box = new BoundingBox(new Vector3d(0, 0, 0), new Vector3d(5, 5, 5));
BoundingSphere sphere = new BoundingSphere(new Vector3d(3, 3, 3), new Fixed64(1));
bool intersects = box.Intersects(sphere);
Console.WriteLine(intersects); // Output: True

Trigonometry Example

Fixed64 angle = FixedMath.PiOver4; // 45 degrees
Fixed64 sinValue = FixedTrigonometry.Sin(angle);
Console.WriteLine(sinValue); // Output: ~0.707

🛠️ Compatibility

  • .NET Standard 2.1
  • Unity3D Version: 2022.3+
  • Platforms: Windows, Linux, macOS, WebGL, Mobile

đź“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


👥 Contributors

  • mrdav30 - Lead Developer
  • Contributions are welcome! Feel free to submit pull requests or report issues.

đź’¬ Community & Support

For questions, discussions, or general support, join the official Discord community:

👉 Join the Discord Server

For bug reports or feature requests, please open an issue in this repository.

We welcome feedback, contributors, and community discussion across all projects.


Comments

No comments yet. Be the first!