XRGeospatialManager.TryLocate(XRGeospatialPose, out XRPoseResult) returns a pose shifted by 4 bytes (struct layout mismatch with native)
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- mobile-dev
調査の方向性
Start by tracing XRGeospatialManager.TryLocate(XRGeospatialPose, out XRPoseResult) and compare the C# XRPoseResult layout with the native XrGeospatial_locate output. Check the bundled Geospatial sample's EarthIndicator to confirm the reported position and flags issue. Done when a round trip returns the expected pose and flags, and the sample displays the correct position.
索引モデルが issue の本文から書いたものです。
説明
Environment
- Android XR Extensions for Unity 1.5.0 (b18fccf)
- Unity 6000.5.11f1
- OpenXR Plugin 1.17.1, Unity OpenXR Android XR 1.5.0, AR Foundation 6.5.0
- Device: iPhone 17 / iOS 26.5
Summary
XRPoseResult declares LocationFlags as XrSpaceLocationFlags (ulong, 8 bytes). XrGeospatial_locate appears to write a 4-byte flags field, so everything after it is read 4 bytes off:
C# field Actually contains
LocationFlags (high 32 bits) position.x
Pose.position (position.y, position.z, rotation.x)
Pose.rotation (rotation.y, rotation.z, rotation.w, 0)
TryLocate(Pose, out XRGeospatialPoseResult) seems unaffected, because the nested XRGeospatialPose is 8-byte aligned and starts at offset 8 on both sides. Its returned latitude and longitude are correct.
Repro
var input = new Pose(new Vector3(1, 2, 3), Quaternion.identity);
if (mgr.TryLocate(input, out XRGeospatialPoseResult geo) &&
mgr.TryLocate(geo.Pose, out XRPoseResult back))
{
Debug.Log($"{back.Pose.position:F3} {back.Pose.rotation:F3} {((ulong)back.LocationFlags):X16}");
}
- Expected: (1, 2, 3), about (0, 0, 0, 1), and flags with the high 32 bits at zero.
- Actual: position (2, 3, 0), rotation about (0, 0, 1, 0), and the high 32 bits of the flags decode (BitConverter.Int32BitsToSingle) to 1.0.
This also affects the bundled Geospatial sample (EarthIndicator). Its position comes out wrong and the debug text shows odd LocationFlags values.
Workaround
Reinterpret the result:
ulong raw = (ulong)r.LocationFlags;
var flags = (XrSpaceLocationFlags)(raw & 0xFFFFFFFF);
var pos = new Vector3(BitConverter.Int32BitsToSingle((int)(raw >> 32)), r.Pose.position.x, r.Pose.position.y);
var rot = new Quaternion(r.Pose.position.z, r.Pose.rotation.x, r.Pose.rotation.y, r.Pose.rotation.z);
With this, round trips and world-space anchor placement are correct.
Suggested fix
Make the native side write 64-bit flags, which is what OpenXR's XrSpaceLocationFlags is (XrFlags64). Alternatively, change the C# marshaling struct to use a 32-bit flags field.
- 主要言語
- C#
- スター
- 95
- フォーク
- 14
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
android/android-xr-unity-package のほかの issue
-
[Feature Request] Support XR_MSFT_first_person_observer for accurately aligned mixed reality captureオープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
android/android-xr-unity-package#30 · コメント 1 件 ·
-
難易度 4/5 1〜2日 初心者へのやさしさ 18/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
android/android-xr-unity-package#26 · コメント 1 件 ·
android/android-xr-unity-package の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Facepunch/sbox-public#12456 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
mcneel/rhino.inside-revit#1736 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
reactiveui/Primitives#254 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Kyrodan/KeeAnywhere#510 ·
-
area-Tools-ILLink untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信