scenekit

SceneKit: vertically center scaled SCNNode inside parent?

痞子三分冷 提交于 2019-12-12 03:37:32
问题 The goal is to scale a SCNNode and vertically center it within its parent. However, scaling a SCNNode does not affect its bounding box and computing the scaled height does not work. Without an accurate height, how can you vertically center the node inside its parent? To illustrate the problem with using the scaled height, see the attached file, Tiki.dae. The original height of the asset (as shown by the bounding box) is 324.36. If you set the Y-scale to 0.01, however, the height doesn't

Physics Issue When Loading SCNScene from .dae

家住魔仙堡 提交于 2019-12-12 02:47:17
问题 I am attempting to load a scene that is currently just 3 walls, a ceiling and a floor. I am loading the scene that I created in blender and load it in fine. However, a SCNNode with a geometry of a SCNBox just falls right through. The box has a dynamic physics body attached to it and the I am manually setting the walls/floor to be static nodes. Below is the code I am using to set up the scene and add the box, I can also post my .dae if needed. Anyone have any ideas as to what might be going on

Handling one-time immutable data created by app

吃可爱长大的小学妹 提交于 2019-12-12 02:43:30
问题 I'm rewriting my app to incorporate SceneKit to display molecules. About 60% of my code is dedicated to creating these molecules as SCNNode arrays stored in a dictionary. Another 20% creates a String dictionary for text display. Ideally, these dictionaries need only be created once. Currently I'm creating these dictionaries by calls from viewDidLoad in my main (and initial) VC. I then archive the dictionaries: NSKeyedArchiver.archiveRootObject(moleculeDictionary, toFile: filePath) I then read

SpriteKit: touchesEnded/ mouseUp sent to released object

六月ゝ 毕业季﹏ 提交于 2019-12-12 02:42:08
问题 I have the problem that touchesEnded (on iOS) or mouseUp (on macOS) is still called on released objects when the touch/click was started before the release. This behavior is causing crashes in my project. I made a stripped down program with SceneKit and a SpriteKit overlay but I am not sure what I am doing wrong. I've started with the SceneKit game template (iOS or macOS) and I've added two classes: In GameViewController.m at the end of -(void)awakeFromNib I added this: OverlayScene *overlay=

Apply SCNAction to a node with constraints in SceneKit

此生再无相见时 提交于 2019-12-12 01:46:57
问题 I have a node that have a constraint; to be more specific, it has an SCNLookAtConstraint : let constraint = SCNLookAtConstraint(target: scene.retriveNodeFromScene(cameraNodeName)) constraint.gimbalLockEnabled = false self.constraints = [constraint] But when I want to move node to other coordinates it just doesn't move. I don't receive any error, just nothing happens. I have made some tests, and if I remove constraint, everything is ok, node moves with no problem. So, what should I do? Is

ARKit hitTest(_:options:) to select placed 3d-objects not working

狂风中的少年 提交于 2019-12-12 01:16:35
问题 I am trying to select an object which has been placed on a detected plane in order to perform various task on it such as rotating through gestures. In order to search for placed objects and avoid getting hitTestResults of irrelevant nature (eg. selecting the plane or the ARWorldMap itself) I am trying to use hitTest(_:options:) with SCNHitTestOption.categoryBitMask. However it seems as the hitTest returns results of all types, not just objects with the selected categoryBitMask = 5, even

Node Rotation In SceneKit SceneKitRotation

佐手、 提交于 2019-12-12 00:33:01
问题 I have just jumped in to using scene kit for iOS for the first time. What I am trying to do is import a .dae file, and rotate the object in code. What is happening is that when I import my file, I see that it is oriented the way I would expect. This is great, now I want to rotate it so that the longer end goes horizontally. With my coordinate system this should be a 90 degree rotation around the Z axis. Doing that in the graphical part of xcode shows this. The problem comes in when I start to

How to clip ARSCNView bounds to circle?

纵饮孤独 提交于 2019-12-11 18:43:38
问题 Should be straightforward to clip an ARSCNView since ARSCNView is a subclass of UIView. After boilerplate ( sceneView.session.run(configuration) ) logic, adding a scene view programmatically works in the ViewController: sceneView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(sceneView) NSLayoutConstraint.activate([ sceneView.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 1.0), sceneView.heightAnchor.constraint(equalTo: sceneView.widthAnchor, multiplier: 1.0)

SceneKit get node position after rotation

微笑、不失礼 提交于 2019-12-11 18:30:17
问题 For example I have two SCNNode s with SCNBox geometry positioned one after another increasing x position property: SCNBox(width: 0, height: 0, length: 0.02, chamferRadius: 0) Then I want to rotate the first one using rotation property with SCNVector4 , but when rotation happens I want my second node to follow the first one and change its position according rotation of the first one. I found this solution on the web and tried to print node's position , worldPosition and presentation.position

Convert ( .obj / .fbx ) to .dae runtime which must support iOS SceneKit

风流意气都作罢 提交于 2019-12-11 17:31:27
问题 I am facing trouble to find a way to convert .obj / .fbx to .dae (iOS scenefit Supported) automatically in background. In python, it may be available to convert the file from .obj / .fbx to .dae file format. This process should run in background, immediately run after we will get .obj / .fbx file on server. Here is the sample file, which we are trying to convert. https://s3.ap-south-1.amazonaws.com/p9-platform/DAE/barware_s11624.obj Please help me, if you have any suggestion. 回答1: Scenekit on