scenekit

SceneKit, flip direction of SCNMaterial

江枫思渺然 提交于 2019-12-07 00:26:17
问题 extremely new to SceneKit, so just looking for help here: I have an SCNSphere with a camera at the center of it I create an SCNMaterial, doubleSided, and assign it to the sphere Since the camera is at the center, the image looks flipped vertically, which when having text inside totally messes things up. So how can i flip the material, or the image (although later it will be frames from a video), any other suggestion is welcome. This solution, btw, is failing on me, normalImage is applied as a

iOS10 - can't render Sprite Kit scene within SceneKit with openGL

拥有回忆 提交于 2019-12-06 22:32:26
问题 Since I've updated to iOS 10, I'm not able anymore to render a Sprite Kit scene to a Scene Node while using openGL for rendering. Things work fine with Metal. The error logs: "Failed to create IOSurface image (texture)" I used to be able to do something like: class ViewController: UIViewController { @IBOutlet weak var scnView: SCNView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. scnView.showsStatistics = true

Chase camera in SceneKit

99封情书 提交于 2019-12-06 14:50:50
Say I have a node which is a cube and I am moving it within the scene, how can I have a camera that follows the box? I understand there is SCNLookAtConstraint , but what I am after is a chase camera. One that actually changes it's position so that it is sort of attached behind the node. I have not found any example code which shows a way of implementing this, does anyone have any ideas? Can you not make your camera node a child node of the box node? Plenty of good ideas here already. :) Here's a third (and fourth?) option: in iOS 11 (and macOS 10.13, etc) there are a lot more SCNConstraint

How to Add a FadeOut Duration to a SCNAction

旧巷老猫 提交于 2019-12-06 14:46:36
问题 Hey im trying to figure out how to end scnActions moveto action with a fade out duration. Basically i have a car the car moves to the spot but then suddenly stops Once the action is complete. I was hoping to try and get the car to stop more smoothly. but really i need to figure out how to get a fade out duration on an scnAction anyway. Also I checked on Apple's Developer page but that didn't help. And If the solution is there. I don't know how to put it into usable swift code. Failed Code

Scenekit - physicsWorld setup to prevent kinematic nodes to intersect

半世苍凉 提交于 2019-12-06 14:45:49
问题 I have several nodes in my scene which i can rotate and drag around. I've set up a physicsWorld delegate, added physicsBody with type kinematic to my nodes and check for physicsWorld didBeginContact - up to this point everything is ok, when i move the nodes , the contact begin/end fires. The way i'm trying to handle this is to set a bool var that change to true once the contact start to prevent further movement, but i'm running into cases (especialy if i drag the node too fast) , that the

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

ぐ巨炮叔叔 提交于 2019-12-06 14:29:06
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: CGFloat(planeAnchor.extent.x), height: CGFloat(planeAnchor.extent.z)) planeNode = SCNNode(geometry:

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

試著忘記壹切 提交于 2019-12-06 14:27:53
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 with: let point = CGPoint(x: landmarkPt.x * faceBounds.width + faceBounds.origin.x, y: (1.0 -

UIView as SCNMaterialProperty on iOS

早过忘川 提交于 2019-12-06 14:25:39
When using a UIView as an SCNMaterialProperty in a SceneKit scene, can that view be part of the responder chain? To clarify how: omg_you_can_use_an_actual_uiview_now = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 500)) material_plane.diffuse.contents = omg_you_can_use_an_actual_uiview_now let geom_plane = SCNPlane(width: 1, height: 1) geom_plane.materials = [material_plane] 来源: https://stackoverflow.com/questions/48425281/uiview-as-scnmaterialproperty-on-ios

SCNScene: Calculate projected size of an object

空扰寡人 提交于 2019-12-06 14:23:27
问题 My game has a scene and HUD (SKScene) as in most games. To avoid overlap with HUD elements, I need to calculate the projected size of my main object. Because the HUD dimensions and projected size of the object are different for each iPhone model, I need a way to do this dynamically, and for that I need to get the projected size of my main object. The obvious approach for me was to use the xFov and yFov, but for some reason they are always zero. usesOrthographicProjection is set to false so it

SceneKit: advice on reproducing glowing light trail like with Tron light cycles

北战南征 提交于 2019-12-06 13:44:57
The goal is to reproduce a light trail similar to the image below in SceneKit. The trail doesn't need to be as detailed, but the idea is to achieve a similar visual effect. We tried using thin cubes with opacity around 0.5. We strung about 200 together and attached them to a node to act as a light trail. That was not performant at all. This other post suggests using particle emitters, but we also need to detect collisions when another object hits the trail. Class documentation says collision detection with particle emitters is also not performant. Any suggestions on the best way to do simulate