scenekit

In SceneKit, does an SCNLight of type SCNLightTypeAmbient ignore the categoryBitMask parameter?

北城以北 提交于 2019-12-10 13:49:39
问题 It seems to! Here the categoryBitMask is ignored: ambientLight = [SCNLight light]; ambientLight.color = [UIColor colorWithRed:0.994 green:0.715 blue:0.179 alpha:1.000]; ambientLight.type = SCNLightTypeAmbient; ambientLight.categoryBitMask = 1; Here it works! ambientLight = [SCNLight light]; ambientLight.color = [UIColor colorWithRed:0.994 green:0.715 blue:0.179 alpha:1.000]; ambientLight.type = SCNLightTypeOmni; ambientLight.categoryBitMask = 1; 回答1: That's right, ambient light's

Add UIView (from xib) with transparency to SceneKit

孤街浪徒 提交于 2019-12-10 13:19:50
问题 I'm trying to load a UIView into SceneKit with a translucent background, but currently, it just fades to white as I decrease the opacity. I have a very simple UIView layout in a .xib file that I want to load into SceneKit. So far I can display the UIView in the SCNMaterial, change any text fields, images, etc inside the view without a problem. However, I cannot let it have transparency. If I change the alpha of the view it just fades to white. most of the code is the below: if let cardView =

ARKIT : place object on a plane doesn't work properly

这一生的挚爱 提交于 2019-12-10 11:07:52
问题 I am learning ARKit and trying to place an object on a detected plane. But it doesn't work properly and there's a space between the plane and the 3D object. here's my code for the plane detection : func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { position = SCNVector3Make(anchor.transform.columns.3.x, anchor.transform.columns.3.y, anchor.transform.columns.3.z) guard let planeAnchor = anchor as? ARPlaneAnchor else { return } let plane = SCNPlane(width:

Can ARKit display WKWebview?

让人想犯罪 __ 提交于 2019-12-10 11:07:51
问题 Tried ARKit to show WKWebView and all I got is a page that shows background but no foreground. The page can be scrolled though. I attached Apple web page as screenshot. Here's the code: DispatchQueue.main.async { let webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 640, height: 480)) let request = URLRequest(url: URL(string: "https://www.apple.com")!) webView.load(request) plane.firstMaterial?.diffuse.contents = webView } Does that mean ARKit cannot display web page? I am using iOS 12

Difficulty getting depth of face landmark points from 2D regions on iPhone X (SceneKit/ARKit app)

岁酱吖の 提交于 2019-12-10 11:03:44
问题 I'm running face landmark detection using the front-facing camera on iPhone X, and am trying very hard to get 3D points of face landmarks (VNFaceLandmarkRegion2D gives image coordinates X, Y only). I've been trying to use either the ARSCNView.hitTest or ARFrame.hitTest , but am so far unsuccessful. I think my error may be in converting the initial landmark points to the correct coordinate system. I've tried quite a few permutations, but currently based on my research this is what I've come up

Pinch gesture scale resetting to 1?

梦想的初衷 提交于 2019-12-10 10:56:23
问题 I was looking at this repo https://github.com/mmohsin991/gestures/blob/master/gestures/ViewController.swift and this example http://www.raywenderlich.com/50398/opengl-es-transformations-gestures I have the following code @IBOutlet var pinchProperty: UIPinchGestureRecognizer! @IBAction func pinchAction(sender: UIPinchGestureRecognizer) { if(dbg){println("scale \(pinchProperty.scale)")} let pinch: CGFloat = pinchProperty.scale switch pinchProperty.state{ case .Began: println("pinch started")

SCNCylinder diffuse.contents - Render different contents for both radius and height sections

柔情痞子 提交于 2019-12-10 10:52:51
问题 Is there any way to render different contents for both radius and height sections I am trying to use a cylinder shaped object and rendering image on it using diffuse.contents of SCMaterial instance myCustomMaterial.diffuse.contents = UIImage(named: "image") It renders this image on cylinder, however same image gets rendered on both height and render section. I would like to render a different image on height section than radius section. Is it possible? 回答1: Use an array of materials. let

Sprite Particle System animation in viewController

一笑奈何 提交于 2019-12-10 10:48:18
问题 I create a macOS single window application and add a Sprite Particle System file with template Stars . and the visual effect just like this: And I want to add it to my viewController, as the guide of this answer, I got the result like this, and it was not which I desired: override func viewDidLoad() { super.viewDidLoad() let scene = SCNScene() let particlesNode = SCNNode() let particleSystem = SCNParticleSystem(named: "Welcome", inDirectory: "") particlesNode.addParticleSystem(particleSystem!

Scenekit PhysicEngine follow rolling ball

空扰寡人 提交于 2019-12-10 10:25:48
问题 I want to follow a rotating sphere in Apple's SceneKit. I've added an LookAt Constraint to the camera and as the sphere falls down the cam aleays points to it but if the sphere rolls away the camera stays at its current position. I want the cam to follow this sphere like in a third persond shooter with a predefined distance to it. If I make the cam a childNode of the sphere the cam "orbits" around it as the ball is rolling. Any ideas how I can follow the ball with the cam? 回答1: It's pretty

Pausing a SceneKit animation

丶灬走出姿态 提交于 2019-12-10 10:14:59
问题 I'm trying to create a test app in which the user can pause an animation by clicking in the SceneView. The SceneView loads the animation from a .dae file created in a 3d app (Cinema 4D). The app successfully plays and loops the animation upon launch. To pause the animation, I used Technical Q&A QA1673 as a reference. In the case of this .dae file, the animation actually comes in as a hierarchy of animations, so I have tried reaching down to each underlying CAKeyframeAnimation and setting its