Posts

Post not yet marked as solved
3 Replies
1.5k Views
Hi, I'm not sure whether to post this here in Vision or in ARKit as it pertains to both. I followed the Apple project "Using Vision in Real Time with ARKit" and added Vision's VNDetectFaceRectanglesRequest.The issue I have is the mapping from Vision to the AR/video screen. I'm testing in portrait mode and the Y-axis works fine. The X-axis seems to be wrong since ARKit appears to have a wider camera than the camera view on the iPhone.What is the correct way to display the boundingBox on the screen/UIKit/ARKit space? I can't use methods like `self.cameraLayer.layerRectConverted(fromMetadataOutputRect: transformedRect)` since I'm not using AVCaptureSession (using ARKit instead).The following code's Y-axis works, but the X-axis is skewed (more so on the sides of the screen). // face is an instance of VNFaceObservation let transform = CGAffineTransform(scaleX: 1, y: -1).translatedBy(x: 0, y: -view.frame.height) let translate = CGAffineTransform.identity.scaledBy(x: view.frame.width, y: view.frame.height) let rect = face.boundingBox.applying(translate).applying(transform)Using ARKit + Vision, I'm not sure how to convert the X axis from Vision's normalized rect to ARKit/UKit's coordinate space. The X origin of the CGRect is noticeably off. The X origin seems like it should be further outward because the iPhone's camera is wider.Thank you
Posted
by rex.
Last updated
.
Post not yet marked as solved
0 Replies
625 Views
Hi,In current/latest Xcode 9, I'm able to select between different templates:BokehConfettiFireRainReactorSmokeStarsAll except for Confetti have a visible animation when I'm looking at the .scnp file in Xcode. Is Confetti bugged or am I not looking at Confetti correctly?Thanks
Posted
by rex.
Last updated
.
Post not yet marked as solved
0 Replies
1.2k Views
In my ARKit app, I have a goal (`SCNTorus` hoop) that I'm shooting `SCNSphere`'s through. I need to detect when the sphere has gone from one side, through the torus, and out the other side of the torus.My current approach is using node `physicsBody.collisionBitMask`'s on both `SCNNode`s. The first node is a node that sits inside the SCNTorus as a detector/sensor node. The other nodes would be the spheres.With `SCNPhysicsContactDelegate`, I'm able to detect the various callbacks like `didEnd` https://developer.apple.com/documentation/scenekit/scnphysicscontactdelegate/1512883-physicsworld.While logging, I'm looking at the `penetrationDistance` of SCNPhysicsContact. The `penetrationDistance` is> The distance of overlap, in units of scene coordinate space, between the two physics bodies.https://developer.apple.com/documentation/scenekit/scnphysicscontact/1522870-penetrationdistance func physicsWorld(_ world: SCNPhysicsWorld, didEnd contact: SCNPhysicsContact) { let maskA = contact.nodeA.physicsBody?.categoryBitMask let maskB = contact.nodeB.physicsBody?.categoryBitMask let penetrationDistance = contact.penetrationDistance if (maskA == CollisionTypeOne) && (maskB == CollisionTypeTwo) { print(penetrationDistance) } else if (maskB == CollisionTypeOne) && (maskA == CollisionTypeTwo) { print(penetrationDistance) } }What I expected was that I could compare the size/diameter of my sphere to the `penetrationDistance`. The reality is `didEnd` fires multiple times for one actual event (ball going through the hoop). The `penetrationDistance` seems too small individually to be helpful.What is the best approach to detect pass through "collision" events in SceneKit?
Posted
by rex.
Last updated
.