gpt4 book ai didi

ios - 如何将 SCNPlane 颜色更改为清晰颜色

转载 作者:行者123 更新时间:2023-12-04 21:31:20 25 4
gpt4 key购买 nike

我正在开发一个 ARKit 项目,该项目在水平平面上点击时需要波纹动画效果。为此,我采用了 UIView 对象并将其作为 SCNPlane 对象 Material 的内容传递。我已将 Ripple 动画添加到 UIView 对象。一切正常。但我无法将 SCNPlane 颜色更改为清晰颜色。我可以为 Material 使用透明度属性。但它也隐藏了 Ripple 动画。所以,我在这里需要的是,SCNPlane 对象的背景颜色应该是透明的,并且应该只向用户显示 Ripple 动画。有人可以帮我解决这个问题。

这是我的代码。

    let location = tapGesture.location(in: self.sceneView)
let results = self.sceneView.hitTest(location, types: .existingPlane)
if !results.isEmpty{

guard let result = results.first else{ return }
let myUIView = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 300, height: 300)))
myUIView.backgroundColor = .red
let plane = SCNPlane(width: 1.0, height: 1.0)
plane.firstMaterial?.diffuse.contents = myUIView
let planeViewNode = SCNNode(geometry: plane)
planeViewNode.eulerAngles.x = Float(-Double.pi / 2)
planeViewNode.position = SCNVector3(result.worldTransform.columns.3.x, result.worldTransform.columns.3.y, result.worldTransform.columns.3.z)

self.sceneView.scene.rootNode.addChildNode(planeViewNode)

//Ripple animation code goes here
}

I took screenshot from Civilisations AR app from BBC. Please refer the screenshot by clicking this link. This is how exactly I need.

最佳答案

退房 this回答。设置 UiView isOpaquefalse为我工作。

关于ios - 如何将 SCNPlane 颜色更改为清晰颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50368057/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com