Make Thargoid laser accuracy dependent on ship accuracy. (10 never misses, 0 is previous behavior, accuracy scale is linear)
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5030 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
134d5c2411
commit
ebc282ca7e
@ -9559,9 +9559,12 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q
|
||||
r_pos = vector_normal_or_zbasis(vector_subtract(my_target->position, position));
|
||||
|
||||
Quaternion q_laser = quaternion_rotation_between(r_pos, kBasisZVector);
|
||||
q_laser.x += 0.01 * (randf() - 0.5); // randomise aim a little (+/- 0.005)
|
||||
q_laser.y += 0.01 * (randf() - 0.5);
|
||||
q_laser.z += 0.01 * (randf() - 0.5);
|
||||
|
||||
GLfloat acc_factor = (10.0 - accuracy) * 0.001;
|
||||
|
||||
q_laser.x += acc_factor * (randf() - 0.5); // randomise aim a little (+/- 0.005 at accuracy 0, never miss at accuracy 10)
|
||||
q_laser.y += acc_factor * (randf() - 0.5);
|
||||
q_laser.z += acc_factor * (randf() - 0.5);
|
||||
quaternion_normalize(&q_laser);
|
||||
|
||||
Quaternion q_save = orientation; // save rotation
|
||||
|
Loading…
x
Reference in New Issue
Block a user