diff --git a/.github/workflows/nexjast-ci.yml b/.github/workflows/nexjast-ci.yml index 3ee09918..4fee9393 100644 --- a/.github/workflows/nexjast-ci.yml +++ b/.github/workflows/nexjast-ci.yml @@ -465,6 +465,10 @@ jobs: shell: bash run: python3 tools/ci/verify_object_messaging.py + - name: Verify flight crossing velocity hand-off + shell: bash + run: python3 tools/ci/verify_cross_region_flight_velocity.py + - name: Verify cross-region llListen and NexBus chat forwarding shell: bash run: | diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 71fd8f9c..0ca39d5b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1859,9 +1859,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); + // CrossRegion previously sent zero velocity for all normal avatars, + // even when they were actively flying. The viewer then decelerated + // abruptly at the region boundary before new physics updates arrived. + // Preserve actual flight velocity; keep ground and seated behavior + // unchanged until separately validated with their movement models. Vector3 vel2 = Vector3.Zero; if((agent.m_crossingFlags & 2) != 0) vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); + else if (isFlying) + vel2 = agent.Velocity; if (m_eqModule != null) { diff --git a/doc/OpenGenesisLINK/FLIGHT_CROSSING_STAGE1.md b/doc/OpenGenesisLINK/FLIGHT_CROSSING_STAGE1.md new file mode 100644 index 00000000..7238454b --- /dev/null +++ b/doc/OpenGenesisLINK/FLIGHT_CROSSING_STAGE1.md @@ -0,0 +1,32 @@ +# OGL regions: flight velocity continuity, stage 1 + +`EntityTransferModule.CrossAgentIntoNewRegionMain` previously populated the +EventQueue `CrossRegion` viewer packet with `Vector3.Zero` for all +ordinary avatars. A seated avatar already retained its horizontal +velocity. Thus a flying avatar was handed to the viewer with **zero +velocity**, even though the destination `AgentData` contains motion +data. This can cause a sudden visible deceleration during flight. + +The first-stage fix sends `agent.Velocity` for **flying avatars**, +while preserving previous default values for walking and seated avatars. +The fallback old CrossRegion packet already sends `agent.Velocity` and +remains unchanged. + +This does **not** make distributed crossings perfectly invisible. +A seamless experience also requires: +- Predicting a boundary crossing from avatar position/velocity, including + diagonal flight and varregion boundaries. +- Preparing child-agent, CAPS and destination region presence **before** + crossing, with sufficient lead time based on velocity and RTT. +- Measuring `SimulationService.UpdateAgent` latency, physics detach/ + attach time, viewer `CrossRegion` receipt and texture/attachment catch-up. +- Keeping predictive work bounded to authorized neighboring regions; + handling cancel/retry/teleport/rapid reversal, and hard stop on rejection. +- Performing real viewer testing for different flight speeds, diagonal + crossings, busy sims, and inter-server transfers; comparing viewer + frame gaps (p50/p95/p99), avatar position discontinuity and velocity + before and after. + +**Tests:** The CI static contract verifies preservation of flying +velocity and unchanged seated fallback. It is not a replacement for +real Firestorm/OGL Viewer motion tests. No claim of zero jerk is made. diff --git a/tools/ci/verify_cross_region_flight_velocity.py b/tools/ci/verify_cross_region_flight_velocity.py new file mode 100644 index 00000000..35226e02 --- /dev/null +++ b/tools/ci/verify_cross_region_flight_velocity.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""Regression contract for preserving flying avatar velocity during CrossRegion.""" +from pathlib import Path + +code=(Path(__file__).resolve().parents[2] / + "OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs").read_text() +block=code.split("public bool CrossAgentIntoNewRegionMain(",1)[1].split( + "private void CrossAgentToNewRegionCompleted(",1)[0] +must=[ +"Vector3 vel2 = Vector3.Zero;", +"if((agent.m_crossingFlags & 2) != 0)", +"vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);", +"else if (isFlying)", +"vel2 = agent.Velocity;", +"m_eqModule.CrossRegion(", +"neighbourRegion.RegionHandle, pos, vel2", +] +for part in must: + assert part in block, part +assert block.index("else if (isFlying)") < block.index("m_eqModule.CrossRegion(") +assert "agent.CopyTo(cAgent,true);" in block +assert "m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx)" in block +print("Flight crossing velocity hand-off: OK")