Aim ray follows the torso elevation (the boresight leveling erased it)
Follow-through on the pitch fix: the view pitched but shots still flew level (user report). Cause: the task-#48 AIM BORESIGHT leveling in the eye's aim-camera publish (L4VIDRND) strips ALL pitch from the pick-ray direction -- correct for the TERRAIN body pitch it was built against, but it also erased the pilot's deliberate R/F elevation. Fix: mech4's per-frame eye compose publishes the torso elevation (gBTEyeElev); the publisher re-applies it onto the LEVELED forward (fwd = (cos e * level, sin e)) before building the basis -- terrain pitch stays stripped, the deliberate aim survives into BTGetAimRay. Sign matches the pixel-calibrated view compose (+ = up). Harness evidence: pinned-down elevation visibly pitches the chase eye into the terrain (the ray basis moves); a full headless aimed-kill could not be driven (the autofire gate needs a designated target and the random spawns wedged short of the truck row) -- aim-at-truck kill needs the human pass. Awaiting human verification (issue #8). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
b85afed925
commit
d9ceddb12a
@@ -11,6 +11,11 @@ float gBTEyeSwayX = 0.0f; // lateral weight-shift (the walk "swagger"), same sou
|
||||
// through the jointtorso HingeRenderable in the draw traversal (see the note in
|
||||
// DPLEyeRenderable::Execute). Kept published for diagnostics/correlation.
|
||||
float gBTEyeTwist = 0.0f;
|
||||
// The player torso's live ELEVATION aim (rad), published by mech4.cpp's HUD
|
||||
// tick. The aim-boresight leveling below (task #48) strips the TERRAIN body
|
||||
// pitch from the pick ray -- this is the pilot's DELIBERATE pitch, re-applied
|
||||
// after the leveling so aimed shots follow the R/F (stick-Y) elevation.
|
||||
float gBTEyeElev = 0.0f;
|
||||
#pragma hdrstop
|
||||
|
||||
#include "l4vidrnd.h"
|
||||
@@ -5835,11 +5840,24 @@ void
|
||||
if (D3DXVec3LengthSq(&fwdLevel) > 1e-6f)
|
||||
{
|
||||
D3DXVec3Normalize(&fwdLevel, &fwdLevel);
|
||||
zax = D3DXVECTOR3(-fwdLevel.x, 0.0f, -fwdLevel.z); // back = -level fwd
|
||||
// TORSO-ELEVATION AIM (pitch-fix follow-through): the
|
||||
// leveling above strips the TERRAIN body pitch -- but the
|
||||
// pilot's DELIBERATE R/F elevation must survive into the
|
||||
// pick ray, or aimed shots fire level over low targets
|
||||
// (the "still fires over the truck" report). Re-apply
|
||||
// the published torso elevation about the level axis:
|
||||
// fwd = (cos e * level, sin e). +e = aim UP (matches
|
||||
// the view compose's pixel-calibrated sign).
|
||||
extern float gBTEyeElev;
|
||||
const float ce = cosf(gBTEyeElev);
|
||||
const float se = sinf(gBTEyeElev);
|
||||
D3DXVECTOR3 fwdAim(fwdLevel.x * ce, se, fwdLevel.z * ce);
|
||||
D3DXVec3Normalize(&fwdAim, &fwdAim);
|
||||
zax = D3DXVECTOR3(-fwdAim.x, -fwdAim.y, -fwdAim.z); // back = -aimed fwd
|
||||
D3DXVECTOR3 wup(0.0f, 1.0f, 0.0f);
|
||||
D3DXVec3Cross(&xax, &wup, &zax);
|
||||
D3DXVec3Normalize(&xax, &xax);
|
||||
D3DXVec3Cross(&yax, &zax, &xax); // == world +Y
|
||||
D3DXVec3Cross(&yax, &zax, &xax);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4966,6 +4966,12 @@ void
|
||||
Radian(Radian::Normalize(gBTLookPitch + elev)),
|
||||
Radian(Radian::Normalize(gBTLookYaw)),
|
||||
Radian(0.0f));
|
||||
// ...and the AIM RAY: the boresight publisher (L4VIDRND task
|
||||
// #48) LEVELS the view direction (drops terrain body pitch) --
|
||||
// publish the deliberate elevation so it re-applies onto the
|
||||
// leveled boresight (else shots fire level over low targets).
|
||||
extern float gBTEyeElev;
|
||||
gBTEyeElev = elev;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user