Gyro: BT_GYRO_TRACE per-frame integrator trace -- oscillation verified vs authored constants (task #56)

25-hit MP autofire trace: kick -> damped oscillation -> settle, peaks well
inside clamps, no NaN/drift; measured Y:X frequency ratio 7.75x matches
sqrt(springK.y/springK.x) exactly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-11 09:56:55 -05:00
co-authored by Claude Fable 5
parent 8af278a3f5
commit 1ace2e3cb4
4 changed files with 97 additions and 0 deletions
+27
View File
@@ -643,6 +643,27 @@ void
DEBUG_STREAM << "[gyro-bounce] eyePos=(" << (float)eyePosition.x << ","
<< (float)eyePosition.y << "," << (float)eyePosition.z << ")\n" << std::flush;
}
// BOUNCE TRACE (task #56 verification): BT_GYRO_TRACE=1 logs this gyro's
// integrated state EVERY frame while displaced, uncapped, tagged with the
// instance + a running frame index -- enough to PLOT the oscillation and
// check the damped-spring behaviour against the authored constants.
static const int s_gtrace = getenv("BT_GYRO_TRACE") ? 1 : 0;
if (s_gtrace)
{
static int s_traceFrame = 0;
++s_traceFrame;
const float m2 = eyePosition.x*eyePosition.x + eyePosition.y*eyePosition.y
+ eyePosition.z*eyePosition.z
+ bodyOrientation.x*bodyOrientation.x
+ bodyOrientation.y*bodyOrientation.y
+ bodyOrientation.z*bodyOrientation.z;
if (m2 > 1e-9f)
DEBUG_STREAM << "[gtrace] g=" << (void *)this << " f=" << s_traceFrame
<< " eye=" << (float)eyePosition.x << " " << (float)eyePosition.y
<< " " << (float)eyePosition.z
<< " body=" << (float)bodyOrientation.x << " " << (float)bodyOrientation.y
<< " " << (float)bodyOrientation.z << "\n" << std::flush;
}
if (!NodeRotationEquals(mechJointNode, eyePosition, QuantiseEps)) // FUN_004084fc vs value+0
{
SetNodeRotation(mechJointNode, eyePosition); // FUN_0041d11c = SetTRANSLATION
@@ -844,6 +865,12 @@ void
<< ") t/p/y/v=" << (float)trans << "/" << (float)pitchRoll << "/"
<< (float)yaw << "/" << (float)vibration << "\n" << std::flush;
if (getenv("BT_GYRO_TRACE"))
DEBUG_STREAM << "[gtrace] g=" << (void *)this << " HIT t=" << (float)trans
<< " p=" << (float)pitchRoll << " y=" << (float)yaw << " v=" << (float)vibration
<< " dir=" << (float)dir.x << " " << (float)dir.y << " " << (float)dir.z
<< "\n" << std::flush;
ApplyDamageImpulse (dir.x, dir.y, dir.z, trans); // @4b2d00 the directional knock
ApplyDamageTorque (dir.x, dir.y, dir.z, pitchRoll); // @4b2d23
ApplyDamageImpulse (vibrationDirection.x, vibrationDirection.y,