xr-frame点击gltf模型,计算出的相交位置不准确是怎么回事?
const raycastHit = new xrFrameSystem.RaycastHit(scene)
const desc: RaycastDesc = {
origin: xrFrameSystem.Vector3.createFromArray(value.origin),
unitDir: xrFrameSystem.Vector3.createFromArray(value.dir),
distance: 10000,
hit: raycastHit
}
if (scene.physics.raycast(desc)) {
wx.showToast({title: '---相交了--', icon: 'none'})
if (desc.hit) {
const points = desc.hit.point.toArray()
const shadow = scene.getElementById("shadow")
const mesh = scene.createElement(xrFrameSystem.XRMesh)
mesh.setAttribute("geometry", "cube")
mesh.setAttribute("node-id", "dynamicCube")
mesh.setAttribute("scale", "0.2 0.2 0.2")
mesh.setAttribute("position", points.join(" "))
mesh.setAttribute("states", "alphaMode: BLEND")
mesh.setAttribute("uniforms", "u_baseColorFactor: 1 0 0 1")
shadow.addChild(mesh)
}
}
可以进微信群里问下,应该有人遇到过,不过人太多了,只能+wx:wdmwjm ,邀请进
目前引擎就这样的,希望后面版本功能升级能完善。