Friday, April 17, 2026
HomeiOS Developmentios - What constraint ought to I add to SCNNode with SCNBillboardConstraint...

ios – What constraint ought to I add to SCNNode with SCNBillboardConstraint to restrict its dimension e.g. to 50% of the display screen?

[ad_1]

I’ve an iOS app with a actuality augmented by photos with particular places. Beneath some simplified code to provide you an thought of what I am writing about.

class MyReality: ARSCNView {
  func addAnImage(picture: UIImage, location: SCNVector3) {
    let node = SCNNode()
    node.place = location
    let billboardConstraint = SCNBillboardConstraint()
    billboardConstraint.freeAxes = [.X, .Y, .Z]
    node.constraints = [billboardConstraint]
    let airplane = SCNPlane(width: 1.0, peak: 1.0)
    airplane.firstMaterial!.diffuse.contents = picture
    airplane.firstMaterial!.lightingModel = .fixed
    node.geometry = airplane
    self.scene.rootNode.addChildNode(node)
  }
  /* ... */
}

The nearer a person is to a particular location, the larger a picture will get. I might like photos to have a maximal dimension. Let or not it’s 50% of the display screen. An important for me is to allow customers to see one thing extra than simply a picture when they’re on the unlucky place.

How can or not it’s simply coded?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments