You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public getPickMeshID(): number {
var meshID = this._outBuffer.outFloat32Array[0];
const result = Math.floor(meshID + 0.1);
console.log(meshID, result, 'DDDDDDDDDDDDD')
return result;
}
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: