From f844613295542f4e75809b557bbfe2b450f941b5 Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 19 Apr 2026 10:48:01 +0200 Subject: [PATCH] =?UTF-8?q?test(anim):=20CurrentOmega=20=E2=80=94=20speedM?= =?UTF-8?q?od=20scaling=20for=20TurnRight=20cycles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fills in the test coverage gap for the rotational side of the sequence-wide physics. Symmetric to the existing CurrentVelocity_ScalesWithSpeedMod test: at speedMod=2.0 a MotionData.Omega of (0,0,1) surfaces as (0,0,2). This is what the omega rotation-integrator in TickAnimations reads each tick. 660 tests green. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Physics/AnimationSequencerTests.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/AcDream.Core.Tests/Physics/AnimationSequencerTests.cs b/tests/AcDream.Core.Tests/Physics/AnimationSequencerTests.cs index 55fc874..ac492dd 100644 --- a/tests/AcDream.Core.Tests/Physics/AnimationSequencerTests.cs +++ b/tests/AcDream.Core.Tests/Physics/AnimationSequencerTests.cs @@ -1174,6 +1174,37 @@ public sealed class AnimationSequencerTests Assert.Equal(1.5f, seq.CurrentSpeedMod, 3); } + [Fact] + public void CurrentOmega_ReflectsMotionDataOmega() + { + // A turn cycle with MotionData.Omega = (0, 0, 1) rad/sec (yaw) + // should surface as CurrentOmega = (0, 0, 1) after SetCycle. + // Scales with speedMod exactly like Velocity. + const uint Style = 0x003Du; + const uint Motion = 0x000Du; // TurnRight + const uint AnimId = 0x03000701u; + + var anim = Fixtures.MakeAnim(4, 1, Vector3.Zero, Quaternion.Identity); + var setup = Fixtures.MakeSetup(1); + var mt = new MotionTable(); + mt.DefaultStyle = (DRWMotionCommand)Style; + int cycleKey = (int)((Style << 16) | (Motion & 0xFFFFFFu)); + + var md = new MotionData { Flags = MotionDataFlags.HasOmega, Omega = new Vector3(0, 0, 1.0f) }; + QualifiedDataId qid = AnimId; + md.Anims.Add(new AnimData { AnimId = qid, LowFrame = 0, HighFrame = -1, Framerate = 10f }); + mt.Cycles[cycleKey] = md; + + var loader = new FakeLoader(); + loader.Register(AnimId, anim); + + var seq = new AnimationSequencer(setup, mt, loader); + seq.SetCycle(Style, Motion, speedMod: 2f); + + // Omega scales by speedMod — 1.0 × 2 = 2 rad/sec. + Assert.Equal(2.0f, seq.CurrentOmega.Z, 3); + } + [Fact] public void CurrentVelocity_PersistsThroughLinkTransition() {