scenekit

SceneKit – Mapping physical 360 rotation

亡梦爱人 提交于 2019-11-27 11:17:40
问题 I am having a hard time mapping device motion (sensor fusion) to SceneKit node rotation. The premise of the problem is as follows, I have sphere, and the camera is positioned to be inside the the sphere such that the geometric center of sphere and camera node's center coincide. What i want to achieve is when i rotate physically around a point, the motion needs to be mapped accurately on the camera as well. The implementaion details are as follows: I have a node, with a sphere as geomertry and

Including textures when exporting from Blender to COLLADA/.dae format for use in SceneKit

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 10:59:11
问题 I am able to export meshes created in Blender for use in SceneKit by using the COLLADA/.dae format - however no textures show up on iOS device. Also, Preview on OS X won't open any COLLADA file exported from Blender - yet the sidebar preview does show the mesh. What are the options needed at export to make this work? 回答1: Create a scnassets folder first (not required but useful) Create a folder on your desktop and give it an extension of ".scnassets" Put your collada(.dae) file along with any

Confused about Orthographic Projection of camera in SceneKit

荒凉一梦 提交于 2019-11-27 09:37:24
I want to use orthographic projection to display 3D scene in my app. In my code I put a box in scene and set orthographic projection of Point of view like blow. Camera at (0,0,500) look at -z direction, and box at origin of world. So camera should be able to capture the box. let cameraNode = SCNNode() let pov = SCNCamera() pov.usesOrthographicProjection = true let width = UISreen.main.bounds.size.width let glMat = GLKMatrix4MakeOrtho(-width/2, width/2, -width/2, width/2, 1, 1000) pov.projectionTransform = SCNMatrix4FromGLKMatrix4(glMat) cameraNode.camera = pov cameraNode.position = SCNVector3

iOS revert camera projection

你离开我真会死。 提交于 2019-11-27 09:07:02
问题 I'm trying to estimate my device position related to a QR code in space. I'm using ARKit and the Vision framework, both introduced in iOS11, but the answer to this question probably doesn't depend on them. With the Vision framework, I'm able to get the rectangle that bounds a QR code in the camera frame. I'd like to match this rectangle to the device translation and rotation necessary to transform the QR code from a standard position. For instance if I observe the frame: * * B C A D * * while

node's position appears constant during physics simulation

妖精的绣舞 提交于 2019-11-27 07:32:59
问题 I'm running some physics on a node. The node moves in all directions, but when tracking it's position it appears to be stationary. func renderer(renderer: SCNSceneRenderer, didSimulatePhysicsAtTime time: NSTimeInterval) { print("position.y: \(starNode.position.y)") The message in the debugger is "position.y: 5.578" (which is the position I assigned in Scene Editor) for every call to renderer:didSimulatePhysicsAtTime method What's going on? 回答1: that a look at the presentationNode property. 来源

Change the color or texture of a SCNText node object (Swift - Scenekit)

守給你的承諾、 提交于 2019-11-27 07:01:20
问题 How do I set the texture of a SCNText object? This is what I have and nothing changes in the appearance: // myNode is a working SCNText element let mat = SCNMaterial() met.diffuse.contents = UIImage(contentsOfFile: "texture.png") myNode.geometry.firstMaterial = mat 回答1: A text geometry may contain one, three, or five geometry elements: If its extrusionDepth property is 0.0, the text geometry has one element corresponding to its one visible side. If its extrusion depth is greater than zero and

How can I overlay a SKScene over a SCNScene in Swift?

随声附和 提交于 2019-11-27 06:51:01
问题 There are some overlay tutorials on the Internet, all using overlaySKScene at some point. That is somehow not possible in my project, as (I guess) my view does not use the constructor of SCNView at any point (which overlaySKScene is a part of). In the ViewController's viewDidLoad, basically only the MainScene is created: viewDidLoad() { self.sceneView = MainScene(view: self.view)) } ...which goes here (note: SCNScene instead of SCNView): class MainScene: SCNScene, SCNPhysicsContactDelegate {.

Draw SceneKit object between two points

戏子无情 提交于 2019-11-27 05:23:38
问题 Having made some progress in the geometry side of things I'm moving on to putting together an entire scene. That scene has a couple dozen objects, each defined by a bounding cube whose corners are specified by two SCNVector3s (originally two sets of x,y,z). Here's an example of what I have so far - it's an 11-element log-periodic antenna, like the old school TV antennas from the 70s. Each of the grey lines is an "element", typically made of aluminum rod. I used SCNCylinders from +ve to -ve Y

How to set up SceneKit collision detection

僤鯓⒐⒋嵵緔 提交于 2019-11-27 04:26:00
Hello I have pored over the documentation and can not figure out how to set up collision detection in scene kit. Can some one please show an example. Please help I am very desperate to figure this out. Thank you! Edit: Hello Thank you very much, I'm sorry I forgot to mention my project is in swift. No big deal I can translate my self for the most part. I have the BitMasks working correctly as the objects collide and bounce with each other. However I can not seem to get the function to work func physicsWorld(world: SCNPhysicsWorld, didBeginContact contact: SCNPhysicsContact){ let contactMask =

Extracting vertices from scenekit

旧巷老猫 提交于 2019-11-27 04:25:45
问题 I'm having a problem with understanding scenekit geometery. I have the default cube from Blender, and I export as collada (DAE), and can bring it into scenekit.... all good. Now I want to see the vertices for the cube. In the DAE I can see the following for the "Cube-mesh-positions-array", "1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1" Now what I'd like to do in scenekit, is get the vertices back, using something like the following