No. Player shot, but missed, I want to trace ray the whole circle relative to the shot to find out the accuracy of the shot relative to near enemies.
Player shoot with some eye angle (QAngle), I have direction(get_angle_vectors), length(8192) of the shoot, I have start location of shot(eye_location), but to find out the accuracy I need to ray trace with new QAngle which will differ with every raytrace in loop. It is potential eye_angle with whom he could shoot and hit a enemy.
For example:
Syntax: Select all
shoot_eye_angle - QAngle(80.0, 65.0, 0.0)
shoot_pos - Vector(?, ?, ?)
Init loop:
for i in range(100) {
shoot_eye_angle.x += 0.04
forward = Vector()
direction = shoot_eye_angle.get_angle_vectors(forward, None, None)
engine_trace.trace_ray(
Ray(shoot_pos, shoot_pos + direction * 8192.0),
ContentMasks.SHOT,
trace_filter,
game_trace
)
if 0 < game_trace.entity_index < 65 {
accuracy_percent = 100 - i
break
}
}
It is only by vertically but I think the meaning is clear.
At each iteration in the loop, angle from player potentially eye_angle shoot sum with step angle(0.04), the further we go the worse the accuracy.
Horizontal and vertical can still be endured, but when there are full circle with some trigonometry server freezes.