-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: mode=pixel时,PickFire对于visibleMap的meshID读取存在误差 #420
Comments
能不能提供一下案例?现在不太好确定问题~ 按道理说是不会出现324.75这种meshID的情况的~ |
我这边确实出现过很多次这种情况,因修改了不少源码,不好给案例。 不过,昨天通过将f32的meshId转4个uint8,存在materialMap.rgba中(pick_cs新增此sampler, 并读取存于原来的pick_Tangent中),在 目前还没出现过点击失败的情况,算是一个方案吧。 大概代码
orillusion\src\io\picker\PickCompute.ts
后续如果有其他的问题再反馈,感谢回复。 |
Orillusion_admin 你好, 我也遇到一些pixel pick的問題, 在 PickCompute中的normal計算: target.set(x * 2.0 - 1.0, y * 2.0 - 1.0, z * 2.0 - 1.0).normalize(); 這行,如果用一個立方體來驗證,那求得的normal會難以反推pick到立方體的哪個面向. 但是如果改成target.set(x, y, z).normalize(); 就可以. 原本打算繼承PickCompute來override此function,但無奈PickFire/PickCompute幾個關鍵member variables都是private. |
Bug描述
我在实现一个拾取功能,但在测试中,PickFire返回的meshID经常错误,从而找不到对应的ColliderComponent,最终导致拾取不到物体
Bug复现流程
通过以下步骤产生bug:
orillusion\src\loader\parser\gltf\GLTFSubParserConverter.ts
中的convertprimitives
方法,给类型为Object3D的model
添加ColliderComponent
PickFire
POINTER_CLICK
进行监听,并主动触发PickFire.pickMeshId
demo.ts
期待的结果
PickFire要拾取到准确的meshId
报错截图
测试引擎版本:
本地运行出错的Orillusion引擎版本v0.7.2
本机系统 (请填写完整):
本机配置
代码示例
其他信息
meshID可能存在小数点,然后又使用Math.floor读取(假设visibleMap返回meshID结果为324.75, 那么即使加上0.1,经过floor后结果也是324,实际上325才是对的meshID),这是一种情况,可能还有其他原因。
The text was updated successfully, but these errors were encountered: