scenekit

How to generate USDZ file again from ZIP file?

冷暖自知 提交于 2019-12-19 11:31:56
问题 Hello everyone I'm trying to unzip a USDZ file, modify a texture, and then zip the USDZ file again, but it breaks. Is there any special way to zip the file back? Even if I decompress and compress again it stops working and has different file size. I'm using no compression and no encryption to zip the file. One thing I have noticed is that the attribute "Needed to extract" for the USDZ file is "2.0 or later" while my new zip file value is "1.0 or later". Also the files in the original USDZ zip

Scenekit shape between 4 points

∥☆過路亽.° 提交于 2019-12-19 10:11:09
问题 Given that the route I was taking in a previous question: ARKit - place a SCNPlane between 2 vector points on a plane in Swift 3 ...seems to be flawed, I'm looking at other options. I can draw a line between 2 nodes, I can then create nodes above those, effectively in a square but even if I draw lines between them all, I can't make that into a shape. Is it possible in Scenekit to draw a shape (square) where each of the 4 corners joins to a node. I can create a plane, position it on a node,

removing SCNNode does not free memory before creating new SCNNode

孤人 提交于 2019-12-19 08:11:49
问题 I am building an app that uses Scenekit to display a scene based on information returned from a data base. I have created a custom class with a class func that creates a SCNNode containing everything that needs to be drawn and returns it to my SCNView. Before calling this function I remove any existing nodes. Everything works great until I need to call it a second time. After removing the old SCNNode The memory is not deallocated before creating the new one. Is there a standard way of

How to move a rotated SCNNode in SceneKit?

♀尐吖头ヾ 提交于 2019-12-19 06:19:17
问题 The image below shows a rotated box that should be moved horizontally on the X and Z axes. Y should stay unaffected to simplify the scenario. The box could also be the SCNNode of the camera, so I guess a projection does not make sense at this point. So lets say we want to move the box in the direction of the red arrow. How to achieve this using SceneKit? The red arrow indicates -Z direction of the box. It also shows us it is not parallel to the camera's projection or to the global axes that

Get SCNVector3 from CGPoint

我的梦境 提交于 2019-12-19 04:00:32
问题 I am trying to get a SCNVector3 from a CGPoint. I am using a gesture recognizer to get the location of a touch (as a CGPoint). The problem is that the touch doesn't always hit something when I hit test because there isn't always an object being touched. (Touch an empty space to move your ship to that empty spot). Other Stack Overflow question that I have found uses the SCNHitTestResult to get the worldCoordinates but that doesn't work for me. Does anyone know how to find this? Given that I

How to rotate object in a scene with pan gesture - SceneKit

荒凉一梦 提交于 2019-12-19 03:01:10
问题 I'm tying to create an app with Scene kit to solve Rubix Cube. I've my own dae file for the cube. this is my setup code in viewDidLoad let myscene = SCNScene(named: "Rubik1.scnassets/Rubiks_Cube.dae") scene.rootNode.addChildNode((myscene?.rootNode)!) // retrieve the SCNView let scnView = self.view as! SCNView // set the scene to the view scnView.scene = scene geometryNode = (scnView.scene?.rootNode.childNodeWithName("Cube",recursively: true))! let panRecognizer = UIPanGestureRecognizer(target

What is an example of drawing custom nodes with vertices in swift SceneKit?

喜你入骨 提交于 2019-12-19 02:08:22
问题 This area is hardly documented online and it would be great to see a working Swift 3 example, of say, a custom drawn cube with manual SCNvector3s. There is this in objective-C but not Swift. This might not be a usual form of question but I know it would help many. If there is somewhere I missed, please mention. The documentation is not very helpful scngeometrysource, etc. Thanks 回答1: A custom geometry is constructed from a set of vertices and normals. Vertices In this context, a vertex is a

Creating a custom SCNGeometry polygon plane with SCNGeometryPrimitiveType polygon crash/error

ε祈祈猫儿з 提交于 2019-12-18 13:39:10
问题 I'm trying to create a custom SCNGeometry in the form of a plane with custom shape, which could be placed in an ARKit session. I'm using the option SCNGeometryPrimitiveTypePolygon in the following method which seems to work fine: extension SCNGeometry { static func polygonPlane(vertices: [SCNVector3]) -> SCNGeometry { var indices: [Int32] = [Int32(vertices.count)] var index: Int32 = 0 for _ in vertices { indices.append(index) index += 1 } let vertexSource = SCNGeometrySource(vertices:

SceneKit water like in Badger example

北城以北 提交于 2019-12-18 13:36:53
问题 Does enybody know how to create water material like in badger example from Apple? There is a "geotherm_01" object in "scene.scn" and this object got materials "_1_terrasses_orange_water" and "_1_terrasses_eau" which creates water with slow animation that looks realistic. I've tried to repeat same materials in my testing project but can't get the same result. 回答1: This water effect was achieved using shader modifiers as shown in the SceneKit Scene Editor within Xcode. The most important

COLLADA transformations in SceneKit

a 夏天 提交于 2019-12-18 12:47:09
问题 We try to make viewer for models in Xcode and use SceneKit to render model. If we add COLLADA (.dae) file to Xcode, it transforms the model using scntool to c3d format (found this on the Internet). But we want to load models in runtime (we download them from server to iOS device). How can we transform .dae to this format not from Mac OS? Our server running Ubuntu, we can transform model and send it already converted to iOS devices. Thanks a lot! 回答1: you can run scntool manually but you'll