https://github.com/rtldg/sm_closestpos
https://github.com/rtldg/sm_closestpos
sourcemod
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rtldg/sm_closestpos
- Owner: rtldg
- Created: 2021-04-02T14:41:31.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-23T21:28:45.000Z (almost 2 years ago)
- Last Synced: 2025-10-17T06:09:39.431Z (5 months ago)
- Topics: sourcemod
- Language: C++
- Homepage:
- Size: 118 KB
- Stars: 4
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sm_closestpos
Sourcemod extension to add a type called `ClosestPos` that you create with an ArrayList of positions which can then be queried for the closest index to a given position.
Currently uses an implementation of k-d trees from https://github.com/jlblancoc/nanoflann
Probably going to use this in https://github.com/shavitush/bhoptimer as it will provide much faster "closest replay time" stuff.
Provides the following:
```
methodmap ClosestPos < Handle {
public native ClosestPos(ArrayList input, int offset=0, int startidx=0, int count=2147483646);
public native int Find(float pos[3]);
};
```
`git checkout --recurse-submodules 1.10-dev`
my building thing
```
git clone git@github.com:rtldg/sm_closestpos.git # https://github.com/rtldg/sm_closestpos.git
cd sm_closestpos
mkdir build
cd build
CC=clang CXX=clang++ python3 ../configure.py --enable-optimize
ambuild
```
windows
```
# open VS2015 x86 Native Tools Command Prompt
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\ext\vcvars.bat"
git clone git@github.com:rtldg/sm_closestpos.git # https://github.com/rtldg/sm_closestpos.git
cd sm_closestpos
mkdir build
cd build
py ../configure.py --enable-optimize
ambuild
```