i playing scenekit trying make star field. here sample stars coordinates:
name: alpheratz, x: 25.9746 y: 0.951042 z: 14.4613 name: caph, x: 8.60001 y: 0.344589 z: 14.4095 name: algenib, x: 115.664 y: 6.68732 z: 31.4421 name: ankaa, x: 19.0837 y: 2.19828 z: -17.4833 name: shedir, x: 37.9848 y: 6.78448 z: 58.3796 name: diphda, x: 27.5836 y: 5.31046 z: -9.11979 name: 96 g. psc, x: 7.25837 y: 1.5555 z: 0.686093 name: van maanen's star, x: 4.14696 y: 0.903519 z: 0.400348 name: cih, x: 79.8367 y: 20.168 z: 146.837
(coordinates hyg database.)
the sceneview full-window view added in storyboard. setup of scene, camera etc. this:
let scene = scnscene() sceneview.scene = scene let camera = scncamera() camera.usesorthographicprojection = true let cameranode = scnnode() cameranode.camera = camera cameranode.position = scnvector3make(0.0, 0.0, 0.0) scene.rootnode.addchildnode(cameranode)
then each star do:
let stargeometry = scnsphere(radius: cgfloat(1.0)) let starnode = scnnode(geometry: stargeometry) starnode.transform = scnmatrix4maketranslation(star.cartesianx.floatvalue, star.cartesiany.floatvalue, star.cartesianz.floatvalue) scene.rootnode.addchildnode(starnode)
this produces shaded spheres in view appear in wrong place , rotate around point somewhere right of screen.
what expect see spheres rotating around camera. move should not change apparent size or swing away camera do. more stars plotted gets harder find see when zoomed out , pan applied disappears.
how can camera fixed @ origin , objects positioned around origin rotate around point?
what expect see spheres rotating around camera. move should not change apparent size or swing away camera do. more stars plotted gets harder find see when zoomed out , pan applied disappears.
how camera behaviour implemented? should not rely on allowscameracontrol
, convenience started rapidly.