ios - 控制缩放行为 ARKit
<p><p>这似乎是一种奇怪的行为,但我想知道是否有办法让屏幕上的节点无论离相机多远都具有相同大小?</p>
<p>我正在尝试在城市中显示 2D 元素(只是文本和图像),其中一些可能很远,但我仍然希望文本和图像可见,但我也不希望它看起来当我离它太近时,它是巨大的。</p>
<p>我目前正在使用 Apple SpriteKit 示例:</p>
<pre><code>override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
{
guard let sceneView = self.view as? ARSKView else
{
return
}
// Create anchor using the camera's current position
if let currentFrame = sceneView.session.currentFrame
{
// Create a transform with a translation of 0.2 meters in front of the camera
var translation = matrix_identity_float4x4
translation.columns.3.z = -0.2
let transform = simd_mul(currentFrame.camera.transform, translation)
// Add a new anchor to the session
let anchor = ARAnchor(transform: transform)
sceneView.session.add(anchor: anchor)
}
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以测量pointOfView 和目标节点之间的距离。并且您可以使用 scale 属性相应地测量目标节点</p></p>
<p style="font-size: 20px;">关于ios - 控制缩放行为 ARKit,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/52612153/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/52612153/
</a>
</p>
页:
[1]