Reset cutscene facing destination with original camera rotation handoff

This commit is contained in:
UnixNight committed 2026-11-05 15:44:25 -05:00
1 parent 7818cc8d64
commit dae13ace73
24 files changed
+2864 -9

No files matched your search

@@ -25,5 +25,45 @@ var idle=JimmyGroundMotion.Input(new(100,130),90,default);Check(idle.State.Targe
var fire=JimmyGroundMotion.Input(new(100,90),90,new(false,true,false,false,false,Fire:true),blockBackward:true);
Check(fire.State.Speed==65&&!fire.HeadingUpdated,"source parent fire acceptance gate suppresses backward");
Console.WriteLine("PASS heading publication and caller-owned backward/fire gate");
using var landing = JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-landing-rotation-reference.json")));
int trajectories = 0;
foreach (var c in landing.RootElement.GetProperty("cases").EnumerateArray())
{
var initial = c.GetProperty("before");
var current = Euler(initial,"current");
var target = Euler(initial,"target");
var dirty = initial.GetProperty("dirty").GetInt32()!=0;
var input = new PlayerInput(c.GetProperty("up").GetInt32()!=0,false,c.GetProperty("left").GetInt32()!=0,false,false);
var state = new JimmyGroundState(0,target.Y);
for (var tick=0;tick<300;tick++)
{
var ground = JimmyGroundMotion.Input(state,current.Y,input);
state = ground.State;
if (ground.HeadingUpdated) { target=new(0,state.TargetYaw,0);dirty=true; }
if (tick==0) Compare("after_input");
var prior = current;
current = JimmyOrientation.Step(current,target,1f/60,dirty:dirty);
if (dirty) dirty=prior!=target;
if (tick==0) Compare("after_facing");
}
Compare("after_300");
trajectories++;
void Compare(string stage)
{
var expected=c.GetProperty(stage);
var e=Euler(expected,"current");var t=Euler(expected,"target");
Near(current.X,e.X,stage+" pitch");Near(current.Y,e.Y,stage+" yaw");Near(current.Z,e.Z,stage+" roll");
Near(target.X,t.X,stage+" target pitch");Near(target.Y,t.Y,stage+" target yaw");Near(target.Z,t.Z,stage+" target roll");
Check(dirty==(expected.GetProperty("dirty").GetInt32()!=0),stage+" dirty");
}
}
Check(trajectories==7,"complete seven original grounded-input/facing trajectories");
Console.WriteLine("PASS7 original grounded-input/facing trajectories: neutral destination retention, dirty ownership and active steering leveling");
static Vector3 Euler(JsonElement state,string key)
{
var values=state.GetProperty(key).EnumerateArray().Select(v=>v.GetSingle()).ToArray();
return new(values[0],values[1],values[2]);
}
static void Check(bool condition,string name){if(!condition)throw new Exception(name);}
static void Near(float value,float expected,string name)=>Check(float.IsFinite(value)&&Math.Abs(value-expected)<.02f,$"{name}: {value} != {expected}");