Returns true if the entity is in front (in sight) of self
(SubgameEntity self, edict_t other)
| 225 | * Returns true if the entity is in front (in sight) of self |
| 226 | */ |
| 227 | public static boolean infront(SubgameEntity self, edict_t other) { |
| 228 | float[] vec = { 0, 0, 0 }; |
| 229 | float dot; |
| 230 | float[] forward = { 0, 0, 0 }; |
| 231 | |
| 232 | Math3D.AngleVectors(self.s.angles, forward, null, null); |
| 233 | Math3D.VectorSubtract(other.s.origin, self.s.origin, vec); |
| 234 | Math3D.VectorNormalize(vec); |
| 235 | dot = Math3D.DotProduct(vec, forward); |
| 236 | |
| 237 | if (dot > 0.3) |
| 238 | return true; |
| 239 | return false; |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Returns 1 if the entity is visible to self, even if not infront(). |
no test coverage detected