Quake III Arena: Fast Inverse Square Root in Unity
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.
- Download the current release for Windows or compile it yourself if you want to.
- Just put the
Q_rsqrt_Unity_DLL_x86.dll
orQ_rsqrt_Unity_DLL_x64.dll
in yourAssets/Plugins
folder in your Unity Project. - 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.
Coming soon.
Coming soon.
- Import the Q3 namespace.
- 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);
}
}
Coming soon.