The first ever, completely fool proof sector checker.
------------------
The Sniper Missions. Current project, The Sniper Missions
The Magician Saber System.
The 2 riddle!
edit - the final, and working
, version
[This message has been edited by Descent_pilot (edited September 18, 2003).]
Code:
The way it works is that it checks to see if the cosine of the angle == 0, then you're on the wall of the sector, and thereby inside. If the cosine is < 0, then you are inside the sector because at least one vertex is behind you and you can't be outside a sector for that to happen. *bows* Have fun.insector = 0; pos = GetThingPos(player); For(i=0; !insector; i=i+1) { For(j=0; j<GetNumSectorVertices(i); j=j+1) { dot = VectorDot(VectorNorm(VectorSub(GetSectorCenter(i), pos)), VectorNorm(VectorSub(GetSectorVertexPos(i, j), pos))); If(dot <= 0) insector = i; } If(i > GetSectorCount()) insector = -1; }
------------------
The Sniper Missions. Current project, The Sniper Missions
The Magician Saber System.
The 2 riddle!
edit - the final, and working
![http://forums.massassi.net/html/biggrin.gif [http://forums.massassi.net/html/biggrin.gif]](http://forums.massassi.net/html/biggrin.gif)
[This message has been edited by Descent_pilot (edited September 18, 2003).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms
Completed
Judgement Day (HLP), My level pack
SATNRT, JK Pistol Mod, Aliens TC, Firearms
Completed
Judgement Day (HLP), My level pack