As per the emarker, I looked at your code and it looks good. I think I'm just going to change the way it checks for the entity not existing by adding a gamemode hook instead. So it doesn't have to resort to a think hook at all. The other features look good in code it's a pity I can't test it.
I've attached the files, please test them if you can and debug them. I just hate think hooks when they are not vital.
As for matrices, I have used them quite a lot and know they aren't exactly like tables. Gmod as a whole is lacking very much as far as matrices are concerned, aVoN is the only one who got anywhere with them and that's not far at all. There are some functions I'd like to point out that may be of some use to you:
Code:
MMatrix = {
Divide = function: 03A02170,
Determinant = function: 039EF990,
Multiply = function: 03B4A358,
Copy = function: 03B3E430,
__error = function: 03B72660,
Trace = function: 039EF630,
Invert = function: 03A076F0,
New = function: 039F82A0,
Sub = function: 039C8258,
Div = function: 03A02170,
RotationMatrix = function: 039E38A0,
Trans = function: 03A62428,
Adj = function: 039CF9F8,
__AddAndSubstract = function: 03BB01D8,
Det = function: 039EF990,
EulerRotationMatrix = function: 039F09E0,
Inv = function: 03A076F0,
Mul = function: 03B4A358,
Stroke = function: 039BB730,
__IsMatrix = function: 039B2A00,
Pow = function: 039AB638,
Adjugate = function: 039CF9F8,
Transpose = function: 03A62428,
Add = function: 039CFEC0,
},
I found this a while back in the gmod code, to be used like MMatrix.Add() and so on, the syntax for which I have no idea. The console errors should help 
You can use console code like this for quicker testing:
Code:
lua_run local matrix=MMatrix.New() print(matrix)
It works like your coding in a file but without line breaks.
You could also just take the code from this lua expansion module: lua-users wiki: Lua Matrix
For quaternion support I just wanted to make sure you knew the base existed. Build from that as it would be less work.
I love math and giving me a reason to use it is what wiremod excels at.
Bookmarks