Skip to content

laurence-trippen/Q_rsqrt_Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Q_rsqrt_Unity

Quake III Arena: Fast Inverse Square Root in Unity

The good or bad idea. IDK.

Since I have always been interested in the Quake III engine (id Tech 3) through Star Wars Jedi Knight II: Jedi Outcast and am a fan of the Fast Inverse Square Root Algorithm I thought it would be interesting to make the algorithm available in the UnityEngine. Apart from whether it makes sense or not, I just wanted to try it out. And so I started the experiment.

Installation

Windows

  1. Download the current release for Windows or compile it yourself if you want to.
  2. Just put the Q_rsqrt_Unity_DLL_x86.dll or Q_rsqrt_Unity_DLL_x64.dll in your Assets/Plugins folder in your Unity Project.
  3. Native plugins are typically bounded to a specific OS or platform. You can use the Unity Inspector to make sure each DLL is included in the right build.

Linux

Coming soon.

macOS

Coming soon.

Usage

  1. Import the Q3 namespace.
  2. Just call the static method float result = Qmath.Q_rsqrt(float number);
using UnityEngine;
using Q3;

public class Tester : MonoBehaviour
{
    public float testValue = 1f;

    private void Start()
    {
        float result = Qmath.Q_rsqrt(testValue);
        Debug.Log(result);
    }
}

Performance / Profiling

Coming soon.