I wrote two cogs for getting the sector at a position in JK. The result will either be the sector that contains that position, or -1 if there is no sector there. They are pretty simple so it would be easy to just copy and paste the code into whatever cog you would want to use it in.
The benefit of this is that you don't need to have a thing at whatever position just to find what the sector is...and, you can test points that are not in sectors.
There was some example of this in the datamaster (as zeq pointed out to me), but it is interesting at best :p
The difference between the simple and heap version is that the heap version precomputes some values and stores them as well as the surface normals in the heap to speed things up.
Both should be quite fast, and the heap version isn't really any more complicated either...
To try out my sample cogs, rename either one to item_fieldlight.cog and activate the fieldight. It'll show you the player's sector, using GetThingPos and my cog's results every second.
http://www.hellraiser64.com/jkhub/download/file/jksectoratpos.zip
The benefit of this is that you don't need to have a thing at whatever position just to find what the sector is...and, you can test points that are not in sectors.
There was some example of this in the datamaster (as zeq pointed out to me), but it is interesting at best :p
The difference between the simple and heap version is that the heap version precomputes some values and stores them as well as the surface normals in the heap to speed things up.
Both should be quite fast, and the heap version isn't really any more complicated either...
To try out my sample cogs, rename either one to item_fieldlight.cog and activate the fieldight. It'll show you the player's sector, using GetThingPos and my cog's results every second.
http://www.hellraiser64.com/jkhub/download/file/jksectoratpos.zip