[英]ARKIT: Observe lagging while drawing line between one SCNNode to another SCNNode
I have draw lines and create box with dimension.我画了线并创建了带有尺寸的框。 Facing lagging issue on iPhone 8 and above but working smooth on iPhone7.
在 iPhone 8 及更高版本上遇到滞后问题,但在 iPhone7 上运行流畅。
For updating lines:对于更新行:
fileprivate func updateLine(_ line: SCNNode, from position: SCNVector3, distance: Float, axis: SCNVector3.Axis) {
guard let box = line.geometry as? SCNBox else {
fatalError("Tried to update something that is not a line")
}
let absDistance = CGFloat(abs(distance))
let offset = distance * 0.5
switch axis {
case .x:
box.width = absDistance
line.position = position + SCNVector3(x: offset, y: 0, z: 0)
case .y:
box.height = absDistance
line.position = position + SCNVector3(x: 0, y: offset, z: 0)
case .z:
box.length = absDistance
line.position = position + SCNVector3(x: 0, y: 0, z: offset)
}
}
iPhone 7: iPhone 7:
CPU: 48%中央处理器:48%
Memory: 199MB内存:199MB
FPS: 60每秒帧数:60
Frame Rendering Time: 1.9 ms帧渲染时间:1.9 毫秒
iPhone 8 Plus: CPU: 48% iPhone 8 Plus: CPU:48%
Memory: 236 MB内存:236 MB
GPU: 4.5图形处理器:4.5
FPS: 60每秒帧数:60
Frame Rendering Time: 16.6 ms帧渲染时间:16.6 毫秒
There is no memory leaks in the project.项目中没有内存泄漏。
I was facing lagging issue for iphone 8 plus and above but drawing line was working smooth on iPhone7 so i implemented我在 iphone 8 plus 及更高版本上遇到了滞后问题,但在 iPhone7 上画线工作顺利,所以我实现了
// Show statistics such as fps and timing information
sceneView.showsStatistics = true
To Compare difference between iPhone7 and iPhone8-plus what i notice that iPhone 8Plus and above taking 18ms frame rendering time and for iphone 7 it was just 1ms frame rendering time so I reduce FPS from default value of 60FPS为了比较 iPhone7 和 iPhone8-plus 之间的差异,我注意到 iPhone 8Plus 及更高版本的帧渲染时间为 18 毫秒,而 iPhone 7 的帧渲染时间仅为 1 毫秒,因此我将 FPS 从默认值 60FPS 降低
sceneView.preferredFramesPerSecond = 40
Now The lagging issue is solved现在滞后问题解决了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.