scenekit

Please help me correctly apply device rotation data

笑着哭i 提交于 2019-12-23 10:58:09
问题 So I have a bit of a project I am trying to do. I am trying to get the devices rotation relative to gravity, and translation from where it started. So basically getting "tracking" data for the device. I plan to basically apply this by making a 3d pt that will mimic the data I record from the device later on. Anyway to attempt to achieve this I thought it would be best to work with scene kit that way I can see things in 3 dimensions just like the data I am trying to record. Right now I have

How to apply a transformation matrix to a vector in SceneKit

夙愿已清 提交于 2019-12-23 09:57:46
问题 Am I missing something here? Amongst the various vector/matrix functions here, I can't see any function to simply apply an SCNMatrix4 transform to an SCNVector4. I could of course do it by writing out the matrix/vector multiplication longhand, but surely that can't be needed? The reason for this is that I'm updating the projection transform for a camera in two steps. First I need to apply one transform to the original transform, then I need to apply this transform to a vector in order to work

Mapping 3D SceneKit Node-Position to 2D Coordinate - projectPoint doesn't work

China☆狼群 提交于 2019-12-23 05:33:04
问题 I am displaying a 3d model consisting of several SNNodes in SceneKit. I am displaying a 2D SpriteKit node on the sceneview-overlay view. The 2D-node position should always be in front of a particular 3D SCNNode. How can I map the 3D position to the SpriteKit 2D position? I tried let screenPoint = sceneView.projectPoint(my3dNode) , but this doesn't work: even when the my3dNode is in the center of the screen, the function returns very weird values (e.g. negative values or over 1000). Do you

Get download progress from SCNScene url

怎甘沉沦 提交于 2019-12-23 05:12:16
问题 I'm working with ARKit, I have trouble getting download progress from SCNScene url. This is my code: func downloadModel(hitTestResult: ARHitTestResult) { DispatchQueue.global().async { // create loading view // I WANT TO GET DOWNLOAD PROGRESS HERE let loading = UIAlertController(title: nil, message: "Please wait...\(downloadProgressValueHere)%", preferredStyle: .alert) let loadingIndicator = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50)) loadingIndicator

How can I load multiple objects in SceneKit?

妖精的绣舞 提交于 2019-12-23 04:57:11
问题 I've made a scn file called arrowsign.scn which contains a arrow like the picture below: I wrote a piece of code to load the arrow object: SCNNode *node = [SCNNode node]; SCNNode *a[10]; for (int i = 0;i<10;i++){ a[i] = [scene.rootNode childNodeWithName:@"arrowsign" recursively:NO];//just one arrow in arrowsign.scn a[i].scale = SCNVector3Make(0.15f, 0.15f, 0.15f); a[i].position = SCNVector3Make(1+i, 0, 0); [node addChildNode:a[i]]; } [scene.rootNode addChildNode:node]; Ideally there will be a

Proper scenekit architecture for multi level/screen games

泪湿孤枕 提交于 2019-12-23 04:52:52
问题 I'm new to scenekit, so when I started my first project I noticed it's slightly different from spritekit. Although not ideal, I used to use 1 gameviewcontroller and 1 gamescene in spritekit to code my entire game. (YES, this includes a menu, game/levels, settings, etc...) I'm now wondering since I'm using SCNScenes (which are just loaded from the viewcontroller), I do not want my 1 view controller to be swamped with code. What is the best way to layout a game? Should i have 1 viewcontroller

How to disabled some default functionality in Scene view when allowsCameraControl = true?

拜拜、爱过 提交于 2019-12-23 04:33:48
问题 Please Help me, I have setup "allowsCameraControl = true" in Scene view. How to disabled some default functionality. 
 Ex : Pan with two fingers to translate the camera on its local xy-plane scnview.allowsCameraControl = true scnview.defaultCameraController.interactionMode = .orbitTurntable scnview.defaultCameraController.inertiaEnabled = true scnview.defaultCameraController.maximumVerticalAngle = 69 scnview.defaultCameraController.minimumVerticalAngle = -69 scnview.autoenablesDefaultLighting

Unwrapping SCNVector3/SCNVector4 values to print?

血红的双手。 提交于 2019-12-23 04:12:31
问题 This should be an easy question import SceneKit import Accelerate var str:SCNVector3 = SCNVector3Make(1, 2, -8) println("vector \(str)" answer vector C.SCNVector3 How to unwrap and display the vector like [ 1, 2, -8]? 回答1: Update for Swift 2: In Swift 2, structures are by default printed with all properties: let str = SCNVector3Make(1, 2, -8) print("vector \(str)") // Output: // vector SCNVector3(x: 1.0, y: 2.0, z: -8.0) You can customize the output by adopting the CustomStringConvertible

How to use SCNTechnique to create a “masked” portal effect in SceneKit / ARKit?

巧了我就是萌 提交于 2019-12-23 03:36:10
问题 I'm trying to wrap my head around how to use SCNTechnique with Scenekit. The effect I'm trying to create can easily be achieved in Unity by adding a custom shader to two materials, making objects with the "filtered" shader to only be visible when it is seen through the other shader (the portal). I've followed this tutorial to create this in Unity: https://www.youtube.com/watch?v=b9xUO0zHNXw I'm trying to achieve the same effect in SceneKit, but I'm not sure how to apply the passes. I'm

Detecting touch in SceneKit

允我心安 提交于 2019-12-23 03:34:11
问题 I have a question that about detecting touch in SceneKit. I have been able to find questions about how to detect when a certain object is touched but I need something a bit more specific. I need to be able to tell when a certain part of an object is touched. To explain a little better, I have a 3d model of a human and I need to be able to tell when say the head is touched or the leg is touched etc. If any further clarification is needed I would be glad to provide it, I'm just not quite sure