Returns 1 if the entity is visible to self, even if not infront().
(SubgameEntity self, SubgameEntity other, GameExportsImpl gameExports)
| 243 | * Returns 1 if the entity is visible to self, even if not infront(). |
| 244 | */ |
| 245 | public static boolean visible(SubgameEntity self, SubgameEntity other, GameExportsImpl gameExports) { |
| 246 | if (other == null) |
| 247 | return false; |
| 248 | |
| 249 | float[] spot1 = { 0, 0, 0 }; |
| 250 | float[] spot2 = { 0, 0, 0 }; |
| 251 | trace_t trace; |
| 252 | |
| 253 | Math3D.VectorCopy(self.s.origin, spot1); |
| 254 | spot1[2] += self.viewheight; |
| 255 | Math3D.VectorCopy(other.s.origin, spot2); |
| 256 | spot2[2] += other.viewheight; |
| 257 | trace = gameExports.gameImports.trace(spot1, Globals.vec3_origin, |
| 258 | Globals.vec3_origin, spot2, self, Defines.MASK_OPAQUE); |
| 259 | |
| 260 | if (trace.fraction == 1.0) |
| 261 | return true; |
| 262 | return false; |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Finds a target. |
no test coverage detected