Posts

Post not yet marked as solved
0 Replies
381 Views
I am going to detect vertical plane and after detection going to place photo frame(3D object) on that plane. Frame is of 8*12 inches. Texture image size putting in frame is 800*1200 pixels. Now I want to put images dynamically with different sizes.As far as I got is need to change material’s contentTransform property(i.e. need to change scale and offset). I tried to change scale and offset in SceneKit editor but not getting how to calculate that contentTransform so that add it programmatically for dynamic image size. (In short I want to display images in frame as we can see images when we open in gallery i.e. Image’s size changes wrt aspect ratio of device size. If image’s width is larger than height then there is black horizontal strip above and below image and if image’s height is larger than width then there is black vertical strip before and after image.)How to achieve this?
Posted
by bhaktib.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
On image marker detection, I want to play animation of walking a guy within that marker only using ARKit. For that I want to find out the position of object while it is walking on marker. Animation is created using external 3D authoring tool and saved in .scnassets as .dae file. I have added node and start animation using below code:func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { let node = SCNNode() if let imageAnchor = anchor as? ARImageAnchor { DispatchQueue.main.async { //let translation = imageAnchor.transform.columns.3 let idleScene = SCNScene(named: "art.scnassets/WalkAround/WalkAround.dae")! // This node will be parent of all the animation models let node1 = SCNNode() // Add all the child nodes to the parent node for child in idleScene.rootNode.childNodes { node1.addChildNode(child) } node1.scale = SCNVector3(0.2, 0.2, 0.2) let physicalSize = imageAnchor.referenceImage.physicalSize let size = CGSize(width: 500, height: 500) let skScene = SKScene(size: size) skScene.backgroundColor = .white let plane = SCNPlane(width: self.referenceImage!.physicalSize.width, height: self.referenceImage!.physicalSize.height) let material = SCNMaterial() material.lightingModel = SCNMaterial.LightingModel.constant material.isDoubleSided = true material.diffuse.contents = skScene plane.materials = [material] let rectNode = SCNNode(geometry: plane) rectNode.eulerAngles.x = -.pi / 2 node.addChildNode(rectNode) node.addChildNode(node1) self.loadAnimation(withKey: "walking", sceneName: "art.scnassets/WalkAround/SambaArmtr", animationIdentifier: "SambaArmtr-1") } } }func loadAnimation(withKey: String, sceneName:String, animationIdentifier:String) { let sceneURL = Bundle.main.url(forResource: sceneName, withExtension: "dae") let sceneSource = SCNSceneSource(url: sceneURL!, options: nil) if let animationObject = sceneSource?.entryWithIdentifier(animationIdentifier, withClass: CAAnimation.self) { // The animation will only play once animationObject.repeatCount = 1 } }How can I get position of object while it is animating?
Posted
by bhaktib.
Last updated
.
Post not yet marked as solved
0 Replies
390 Views
I am going to scan an image and after detection of an image, I am going to place 3D object on that image marker. I want to color that image marker and as I start coloring image marker, virtual object(placed 3D object) also get colored whichever part of image marker get colored dynamically. Is it possible with ARKit? If yes, any hint to achieve this?
Posted
by bhaktib.
Last updated
.
Post not yet marked as solved
0 Replies
419 Views
I am going to scan 3D object and saving reference object in Assets.xcassets/AR Reference Group folder. Then I am recognizing that 3D object. Now object get detected and I can place it in real world but after detection of that object, I want to overlay that virtual 3D object with exact position and orientation on real world 3D object. How can I achieve this?
Posted
by bhaktib.
Last updated
.