fix(sprite): 修复 BillboardY 垂直视角下左右甩动 (fix #504) - #503
Open
GGBond-GIS wants to merge 1 commit into
Open
Conversation
Keep the last valid yaw when the camera direction has no usable XZ projection. Use the world Y axis so camera roll does not affect BillboardY orientation.
Codeboy-cn
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
当 Sprite 使用
BillboardType.BillboardY时,如果相机从 Sprite 的正上方或正下方观察,旋转相机会导致 Sprite 出现明显的左右甩动或朝向跳变。这是因为 BillboardY 会将相机朝向投影到 XZ 平面。当相机垂直观察时,该投影接近零向量,归一化操作会放大浮点误差。同时,原实现使用相机自身的
up向量,使 Sprite 的朝向受到相机旋转影响。复现步骤
BillboardComponent。BillboardType.BillboardY。预期行为
使用
BillboardType.BillboardY时:修改内容
BillboardXYZ和BillboardType.None的行为保持不变。验证
已完成以下检查:
tsc --noEmit -p tsconfig.build.jsongit diff --check通过。影响范围
本次修改仅影响
BillboardType.BillboardY在垂直或接近垂直视角下的朝向计算,不影响其他 Billboard 模式。效果对比
修复前
相机从 Sprite 的垂直方向观察并旋转时,Sprite 会出现左右甩动。

修复后
相同操作下,Sprite 保持稳定,不再出现左右甩动。