convert direction from local space to world space

I know I can use Transform.TransformDirection(Vector3) to do this in unity, however I’m offloading the physics calculations (using bullet physics library) to my remote command line server, so would like to know how the function accomplishes this.

Here are some of the nicely written tutorials on Transformation Matrices.

The gist is that you have to multiply your direction vector with the Transformation Matrix to convert between world to local space. The two matrices in Unity are Transform.localToWorldMatrix and Transform.worldToLocalMatrix.

E.g. transformedVector = Transform.localToWorldMatrix * myVector;