scenekit

Camera position in orthographic projection

旧街凉风 提交于 2020-12-31 13:59:46
问题 I'm trying to understand how to use camera with usesOrthographicProjection = true . I need to set it up so when we first see the scene, the object should be viewable in full. I used the Xcode's SceneKit template, adjust a little bit about the camera (all the code is in viewDidLoad ). Using default camera (perspective projection), it looks like this: cameraNode.position = SCNVector3(x: 0, y: 0, z: ship.boundingBox.max.z + 20) Next, I tried to set the orthographic projection, now it looks like

How to calculate quadrangle for visible part of vertical plane?

三世轮回 提交于 2020-12-31 01:33:54
问题 My goal is to calculate the "visible" part of vertical plane that is anchored to some ARPlaneAnchor and represent it with quadrangle as shown in the picture below: My current approach is based on few hit tests, which unfortunately seems to not giving me the satisfying results. First, when I detect a ARPlaneAnchor I add a big invisible SCNNode to its main node. func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { guard let planeAnchor = anchor as?

Adding 3D object to ARGeoAnchor

拥有回忆 提交于 2020-12-13 05:40:08
问题 Please forgive me if this question is not that great. I've hit a bit of a road block on Apple's documentation of ARGeoAnchor. Currently ARGeoAnchor just shows a blue dot in the AR Scene View. I'm trying to show any 3d rendereing or object instead. My code: let coordinate = CLLocationCoordinate2D(latitude: lat, longitude: lng) let geoAnchor = ARGeoAnchor(name: "Point 1", coordinate: coordinate) let boxGeometry = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0) let cube = SCNNode

What is the difference between Orientation and Rotation in SCNNode

天大地大妈咪最大 提交于 2020-12-06 06:35:22
问题 I am quite confused by the "rotation" and "orientation" for a SCNNode. In Apple's doc, they are defined quite similarly: orientation: The node’s orientation, expressed as a quaternion. Animatable. rotation: The node’s orientation, expressed as a rotation angle about an axis. Animatable. And apple doc says: The rotation, eulerAngles, and orientation properties all affect the rotational aspect of the node’s transform property. Any change to one of these properties is reflected in the others. So