scenekit

Combining scenekit and spritekit in a single screen

痞子三分冷 提交于 2019-12-14 04:17:36
问题 Apologies if this is a newbie question, i'm still trying to find my way around Swift and SpriteKit / SceneKit. Is it possible to combine SpriteKit and SceneKit in a single view, e.g. using SpriteKit to render a map in portion of the screen while using SceneKit to render the main 3D view? 回答1: Yes you can and it was shown in various demos at WWDC. Take a look at the overlaySKScene property of SCNSceneRenderer . 回答2: One way of using SpriteKit within SceneKit is as follows: SCNView *sceneView =

SceneKit view is rendered backwards

我们两清 提交于 2019-12-14 04:13:58
问题 I'm attempting my first SceneKit app. My goal is to simulate a view from the surface of the Earth and being able to point the device's camera in any direction and overlay information over the camera view. To start, I'm simply trying to get the SceneKit camera view to match the device's orientation. To verify that it is working as desired, I am adding a bunch of spheres at specific latitude and longitude coordinates. Everything is working except for one important issue. The view is mirrored

Scene Kit View not showing in window

余生长醉 提交于 2019-12-14 02:39:57
问题 I am building a simulation app as a side project for a school paper I'm writing and I started building it as an iPad app initially, and only later realized I needed it on OSX. I need some way for the user to input values and then I need a Scene Kit View to display my animation. The problem I am encountering (I didn't have this when programming iOS) is that when I am adding a Scene Kit View in the storyboard (as a child of the main View in the only ViewController) it doesn't load. Everything

ARKit : how to get a SCNNode hit by hitTest?

我的梦境 提交于 2019-12-14 02:07:34
问题 I have several planes detected by ARKit and made visible to the user. I want the user to be able to click on the screen in order to keep only the plane he selected, change its color and delete the other ones. My planes are added in the didAddNode delegate method like this: Plane *plane = [[Plane alloc] initWithAnchor: (ARPlaneAnchor *)anchor]; [self.planes setObject:plane forKey:anchor.identifier]; In another method, I catch the click of the user and want to be able to change the color of the

Get “[SceneKit] Error:” when set AVPlayer to SCNMaterial.diffuse.contents

耗尽温柔 提交于 2019-12-14 00:27:14
问题 According Apple's docs, SCNMaterial.diffuse.contents can be a AVPlayer . In this case material appear content of video. Everything seems ok but I get several sceneKit error logs: [SceneKit] Error: Could not get pixel buffer (CVPixelBufferRef) Below is my code. Move [_player play] to viewWillAppear does't help. - (void)viewDidLoad { [super viewDidLoad]; self.boxNode = [self.sceneView.scene.rootNode childNodeWithName:@"box" recursively:YES]; NSString *path = [[[NSBundle mainBundle] resourcePath

SCNView to UIView?

泪湿孤枕 提交于 2019-12-13 21:30:53
问题 Is it possible to translate from a SCNView to a UIView? I have a login button from an overlay on my SCNView but I want the login button to take the user to a UIView to login. 回答1: May not be the most elegant way to do it but something like this might work for you..... - (void) handleTap:(UITapGestureRecognizer*)gestureRecognizer { // get tap location CGPoint p = [gestureRecognizer locationInView:scnView]; // convert to sk scene coordinates CGPoint p2D = [scnView.overlaySKScene

Mixed topology (quad/tri) with ModelIO

青春壹個敷衍的年華 提交于 2019-12-13 17:07:11
问题 I'm importing some simple OBJ assets using ModelIO like so: let mdlAsset = MDLAsset(url: url, vertexDescriptor: nil, bufferAllocator: nil, preserveTopology: true, error: nil) ... and then adding them to a SceneKit SCN file. But, whenever I have meshes that have both quads/tris (often the case, for example eyeball meshes), the resulting mesh is jumbled: Incorrect mesh topology Re-topologizing isn't a good option since I sometimes have low-poly meshes with very specific topology, so I can't

SCNNode Z-rotation axis stays constant, while X and Y axes change when node is rotated

瘦欲@ 提交于 2019-12-13 16:13:33
问题 I have a node that the user can rotate via a pan gesture. The user can select either X, Y, or Z axis and pan, and the node will rotate around that axis. The Issue : The node's front is facing the camera. Let's say the user pans to the right and rotates the node around the Y axis. The node's front is now facing the right. If the user switches to the X axis and pans down, the node's front will rotate downward (or clockwise from the user's perspective) from it's initial right-facing orientation.

NSAttributedString doesn't work with SCNText

主宰稳场 提交于 2019-12-13 15:39:01
问题 I want to display some text inside a SceneKit scene, where the characters have a different color. The documentation of SCNText states: When you create a text geometry from an attributed string, SceneKit styles the text according to the attributes in the string, and the properties of the SCNText object determine the default style for portions of the string that have no style attributes. I tried this but it doesn't work. SCNText seems to ignore the attributes of my string. I checked if the

How to calculate the camera position from Vuforia GL matrix?

醉酒当歌 提交于 2019-12-13 15:25:32
问题 I calculate the camera position of a SCNScene that is rendered in Vuforia. However the object is not staying fixed on the marker but jumping around when moving. The cube in the scene appears only orthographically, no matter how the device is moved around the sides cannot be seen. The camera position is calculated with every frame: // Get model view matrix Vuforia::Matrix44F modelViewMatrix = Vuforia::Tool::convertPose2GLMatrix(result->getPose()); // Convert to extrinsic matrix SCNMatrix4