Skip to content

Commit 3f39f12

Browse files
mrdav30ltomazetto
andauthored
Develop to Main (#23)
* refactor: unity integration (#16) * task: refactor handling of Unity integration * task: bump gitversion/setup to v3.1.1 * ci: update dotnet.yml * fix: dotnet build configuration * fix: dotnet project build configurations * task: update readme * task: support for dotnet v8 (#19) * task: support for dotnet v8 * task: bump artifact actions version * Refactor/unity package (#22) * refactor: seperate unity package into new project * task: update readme * feat: Added IsInteger method in Fixed64.cs and Fixed64.Extensions.cs (#21) * feat: Added IsInteger method in Fixed64.cs and Fixed64.Extensions.cs * fix: using MAX_SHIFTED_AMOUNT_UI instead of uint.MaxValue --------- Co-authored-by: Lucas S. Tomazetto <145228338+ltomazetto@users.noreply.github.com> --------- Co-authored-by: Lucas S. Tomazetto <145228338+ltomazetto@users.noreply.github.com>
1 parent 8808be5 commit 3f39f12

21 files changed

+16
-943
lines changed

.assets/scripts/create-unity-package.ps1

Lines changed: 0 additions & 64 deletions
This file was deleted.

.assets/scripts/set-version-and-build.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
param (
2-
[string]$BuildType = "Release",
3-
[string]$UnityVersion = "2022.3.20f1"
2+
[string]$BuildType = "Release"
43
)
54

65
# Import shared functions
@@ -12,7 +11,7 @@ $solutionDir = Get-SolutionDirectory
1211
Set-Location $solutionDir
1312

1413
# Ensure GitVersion environment variables are set
15-
Ensure-GitVersion-Environment $UnityVersion
14+
Ensure-GitVersion-Environment
1615

1716
# Build the project with the version information applied
1817
Build-Project -Configuration $BuildType

.assets/scripts/utilities.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ function Get-SolutionDirectory {
1414
}
1515

1616
function Ensure-GitVersion-Environment {
17-
param ([string]$UnityVersion = "2022.3.20f1")
18-
1917
# Ensure GitVersion is installed and available
2018
if (-not (Get-Command "dotnet-gitversion" -ErrorAction SilentlyContinue)) {
2119
Write-Host "GitVersion is not installed. Install it with:"
@@ -44,14 +42,12 @@ function Ensure-GitVersion-Environment {
4442
[System.Environment]::SetEnvironmentVariable('GitVersion_AssemblySemVer', $assemblySemVer, 'Process')
4543
[System.Environment]::SetEnvironmentVariable('GitVersion_AssemblySemFileVer', $assemblySemFileVer, 'Process')
4644
[System.Environment]::SetEnvironmentVariable('GitVersion_InformationalVersion', $infoVersion, 'Process')
47-
[System.Environment]::SetEnvironmentVariable('UnityVersion', $UnityVersion, 'Process')
4845

4946
Write-Host "Environment variables set:"
5047
Write-Host " GitVersion_FullSemVer = $semVer"
5148
Write-Host " GitVersion_AssemblySemVer = $assemblySemVer"
5249
Write-Host " GitVersion_AssemblySemFileVer = $assemblySemFileVer"
5350
Write-Host " GitVersion_InformationalVersion = $infoVersion"
54-
Write-Host " UnityVersion = $UnityVersion"
5551
}
5652

5753
function Build-Project {

FixedMathSharp.sln

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,17 @@ EndProject
1616
Global
1717
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1818
Debug|Any CPU = Debug|Any CPU
19-
DebugUnity|Any CPU = DebugUnity|Any CPU
2019
Release|Any CPU = Release|Any CPU
21-
ReleaseUnity|Any CPU = ReleaseUnity|Any CPU
2220
EndGlobalSection
2321
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2422
{61834921-141D-4BD5-9E75-31188DF32E93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2523
{61834921-141D-4BD5-9E75-31188DF32E93}.Debug|Any CPU.Build.0 = Debug|Any CPU
26-
{61834921-141D-4BD5-9E75-31188DF32E93}.DebugUnity|Any CPU.ActiveCfg = DebugUnity|Any CPU
27-
{61834921-141D-4BD5-9E75-31188DF32E93}.DebugUnity|Any CPU.Build.0 = DebugUnity|Any CPU
2824
{61834921-141D-4BD5-9E75-31188DF32E93}.Release|Any CPU.ActiveCfg = Release|Any CPU
2925
{61834921-141D-4BD5-9E75-31188DF32E93}.Release|Any CPU.Build.0 = Release|Any CPU
30-
{61834921-141D-4BD5-9E75-31188DF32E93}.ReleaseUnity|Any CPU.ActiveCfg = ReleaseUnity|Any CPU
31-
{61834921-141D-4BD5-9E75-31188DF32E93}.ReleaseUnity|Any CPU.Build.0 = ReleaseUnity|Any CPU
3226
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3327
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.DebugUnity|Any CPU.ActiveCfg = DebugUnity|Any CPU
35-
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.DebugUnity|Any CPU.Build.0 = DebugUnity|Any CPU
3628
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
3729
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Release|Any CPU.Build.0 = Release|Any CPU
38-
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.ReleaseUnity|Any CPU.ActiveCfg = ReleaseUnity|Any CPU
39-
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.ReleaseUnity|Any CPU.Build.0 = ReleaseUnity|Any CPU
4030
EndGlobalSection
4131
GlobalSection(SolutionProperties) = preSolution
4232
HideSolutionNode = FALSE

README.md

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ Ideal for simulations, games, and physics engines requiring reliable arithmetic
1010

1111
## 🛠️ Key Features
1212

13-
- **Deterministic Calculations:** Perfect for simulations, multiplayer games, and physics engines.
13+
- **Deterministic Calculations:** Ensures consistent results across different platforms.
1414
- **High Precision Arithmetic:** Uses fixed-point math to eliminate floating-point inaccuracies.
1515
- **Comprehensive Vector Support:** Includes 2D and 3D vector operations (`Vector2d`, `Vector3d`).
1616
- **Quaternion Rotations:** Leverage `FixedQuaternion` for smooth rotations without gimbal lock.
1717
- **Matrix Operations:** Supports transformations with `Fixed4x4` and `Fixed3x3` matrices.
1818
- **Bounding Shapes:** Includes `IBound` structs `BoundingBox`, `BoundingSphere`, and `BoundingArea` for lightweight spatial calculations.
1919
- **Advanced Math Functions:** Includes trigonometry and common math utilities.
20-
- **Unity Integration:** Seamless interoperability with Unity using `FixedMathSharp.Editor`.
21-
20+
- **Framework Agnostic:** Works with **.NET, Unity, and other game engines**.
2221

2322
---
2423

@@ -47,19 +46,11 @@ Clone the repository and add it to your project:
4746

4847
- Include the FixedMathSharp project or its DLLs in your build process.
4948

50-
### Unity
51-
52-
To integrate **FixedMathSharp** into your Unity project:
53-
54-
1. **Download the Package**:
55-
- Obtain the latest `FixedMathSharp{{VERSION}}.unitypackage` from the [Releases](https://github.com/mrdav30/FixedMathSharp/releases) section of the repository.
49+
### Unity Integration
5650

57-
2. **Import into Unity**:
58-
- In Unity, navigate to **Assets > Import Package > Custom Package...**.
59-
- Select the downloaded `FixedMathSharp{{VERSION}}.unitypackage` file.
51+
FixedMathSharp is now maintained as a separate Unity package.For Unity-specific implementations, refer to:
6052

61-
3. **Verify the Integration**:
62-
- After importing, confirm that the `FixedMathSharp` namespace is accessible in your scripts.
53+
🔗 [FixedMathSharp-Unity Repository](https://github.com/mrdav30/FixedMathSharp-Unity).
6354

6455
---
6556

@@ -137,10 +128,10 @@ configurable `SHIFT_AMOUNT`.
137128

138129
## ⚡ Performance Considerations
139130

140-
This library leverages **inline methods** and **fixed-point arithmetic**
141-
to ensure high precision without the pitfalls of floating-point numbers.
142-
It is optimized for **deterministic behavior**, making it ideal for physics
143-
engines, multiplayer simulations, and other time-sensitive applications.
131+
FixedMathSharp is optimized for high-performance deterministic calculations:
132+
- **Inline methods and bit-shifting optimizations** ensure minimal overhead.
133+
- **Eliminates floating-point drift**, making it ideal for lockstep simulations.
134+
- **Supports fuzzy equality comparisons** for handling minor precision deviations.
144135

145136
---
146137

@@ -159,9 +150,10 @@ dotnet test --configuration Release
159150

160151
## 🛠️ Compatibility
161152

162-
- **.NET Framework:** 4.7.1+
163-
- **Unity3D:** Fully compatible with Unity using the `FixedMathSharp.Editor` extension.
164-
- **Platforms:** Windows, Linux, macOS
153+
- **.NET Framework** 4.7.2+
154+
- **.NET Core / .NET** 6+
155+
- **Unity 2020+** (via [FixedMathSharp-Unity](https://github.com/mrdav30/FixedMathSharp-Unity))
156+
- **Cross-Platform Support** (Windows, Linux, macOS)
165157

166158
---
167159

src/FixedMathSharp/FixedMathSharp.csproj

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,18 @@
3333
<Deterministic>true</Deterministic>
3434
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
3535
<UnityBuild>false</UnityBuild>
36-
<Configurations>Debug;Release;DebugUnity;ReleaseUnity</Configurations>
36+
<Configurations>Debug;Release</Configurations>
3737
</PropertyGroup>
3838
<!-- Debug and Release-specific Properties -->
3939
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
4040
<DebugSymbols>true</DebugSymbols>
41-
<DebugType>full</DebugType>
4241
<Optimize>false</Optimize>
4342
<DefineConstants>DEBUG;TRACE</DefineConstants>
4443
</PropertyGroup>
45-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugUnity|AnyCPU'">
46-
<DebugSymbols>true</DebugSymbols>
47-
<DebugType>full</DebugType>
48-
<Optimize>false</Optimize>
49-
<DefineConstants>DEBUG;TRACE;UNITY_EDITOR</DefineConstants>
50-
<UnityBuild>true</UnityBuild>
51-
</PropertyGroup>
5244
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
5345
<Optimize>true</Optimize>
5446
<DefineConstants>TRACE</DefineConstants>
5547
</PropertyGroup>
56-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseUnity|AnyCPU'">
57-
<Optimize>true</Optimize>
58-
<DefineConstants>TRACE;UNITY_EDITOR</DefineConstants>
59-
<UnityBuild>true</UnityBuild>
60-
</PropertyGroup>
6148
<!-- NuGet Packaging Metadata -->
6249
<PropertyGroup>
6350
<PackageId>FixedMathSharp</PackageId>
@@ -79,50 +66,8 @@
7966
<ProjectGuid>{61834921-141D-4BD5-9E75-31188DF32E93}</ProjectGuid>
8067
<OutputPath>bin\$(Configuration)\</OutputPath>
8168
</PropertyGroup>
82-
<!-- Set OS-specific Unity Editor absolute/relative folder paths -->
83-
<Choose>
84-
<When Condition="$(UnityBuild)And$([MSBuild]::IsOsPlatform(Windows))">
85-
<PropertyGroup>
86-
<OSInstallRootPath Condition="'$(OSInstallRootPath)'==''">C:\Program Files</OSInstallRootPath>
87-
<UnityManagedDir Condition="'$(UnityManagedDir)'==''">Editor\Data\Managed</UnityManagedDir>
88-
</PropertyGroup>
89-
</When>
90-
<When Condition="$(UnityBuild)And$([MSBuild]::IsOsPlatform(OSX))">
91-
<PropertyGroup>
92-
<OSInstallRootPath Condition="'$(OSInstallRootPath)'==''">/Applications</OSInstallRootPath>
93-
<UnityManagedDir Condition="'$(UnityManagedDir)'==''">Unity.app\Contents\Managed</UnityManagedDir>
94-
</PropertyGroup>
95-
</When>
96-
<When Condition="$(UnityBuild)And$([MSBuild]::IsOsPlatform(Linux))">
97-
<PropertyGroup>
98-
<OSInstallRootPath Condition="'$(OSInstallRootPath)'==''">$([System.Environment]::GetFolderPath('System.Environment+SpecialFolder.UserProfile'))</OSInstallRootPath>
99-
<UnityManagedDir Condition="'$(UnityManagedDir)'==''">Editor\Data\Managed</UnityManagedDir>
100-
</PropertyGroup>
101-
</When>
102-
</Choose>
103-
<!-- Unity Configuration -->
104-
<PropertyGroup Condition="$(UnityBuild)">
105-
<UnityVersion Condition="'$(UnityVersion)'==''">2022.3.20f1</UnityVersion>
106-
<!-- Target Version of Unity -->
107-
<UnityInstallRootDir Condition="'$(UnityInstallRootDir)'==''">Unity\Hub\Editor</UnityInstallRootDir>
108-
<UnityInstallRootPath Condition="'$(UnityInstallRootPath)'==''">$(OSInstallRootPath)\$(UnityInstallRootDir)</UnityInstallRootPath>
109-
<UnityVersionInstallPath Condition="'$(UnityVersionInstallPath)'==''">$(UnityInstallRootPath)\$(UnityVersion)</UnityVersionInstallPath>
110-
<UnityManagedPath Condition="'$(UnityManagedPath)'==''">$(UnityVersionInstallPath)\$(UnityManagedDir)</UnityManagedPath>
111-
<UnityEnginePath Condition="'$(UnityEnginePath)'==''">$(UnityManagedPath)\UnityEngine.dll</UnityEnginePath>
112-
<UnityEditorPath Condition="'$(UnityEditorPath)'==''">$(UnityManagedPath)\UnityEditor.dll</UnityEditorPath>
113-
</PropertyGroup>
11469
<!-- Dependencies and Package References -->
11570
<ItemGroup>
116-
<Reference Condition="$(UnityBuild)" Include="UnityEngine">
117-
<HintPath>$(UnityEnginePath)</HintPath>
118-
<Private>false</Private>
119-
<PrivateAssets>all</PrivateAssets>
120-
</Reference>
121-
<Reference Condition="$(UnityBuild)" Include="UnityEditor">
122-
<HintPath>$(UnityEditorPath)</HintPath>
123-
<Private>false</Private>
124-
<PrivateAssets>all</PrivateAssets>
125-
</Reference>
12671
<PackageReference Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.3">
12772
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
12873
<PrivateAssets>all</PrivateAssets>
@@ -135,8 +80,4 @@
13580
<None Include="..\..\icon.png" Pack="true" PackagePath="\" Visible="false" />
13681
<None Remove=".gitignore" />
13782
</ItemGroup>
138-
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseUnity|AnyCPU'">
139-
<Compile Remove="Integration\**" />
140-
<Content Include="Integration\**" />
141-
</ItemGroup>
14283
</Project>

src/FixedMathSharp/Integration/Unity/Attributes/FixedNumberAngleAttribute.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/FixedMathSharp/Integration/Unity/Attributes/FixedNumberAttribute.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/FixedMathSharp/Integration/Unity/Attributes/VectorRotationAttribute.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)