[LUA] Best way to track an object's location?
I've got a series of scripts for spell effects generated by the characters of my D&D group, but they all hinge off of a few lines of script that constantly track the locations of their character objects.
Those lines are:
```function onUpdate()```
``` if mainPC ~= nil then```
``` pos_PC = mainPC.getPosition()```
``` rot_PC = mainPC.getRotation()```
``` end```
```end```
Now as I'm sure you can guess, the problem is with onUpdate lagging everything to shit, especially when the function is duplicated across six different player effects trackers, a time of day tracker, and some other things I'm sure I'm forgetting.
There has to be a better way of doing this. Any ideas?