ios - How to Constantly get rotation/eulerAngles values of ARCamera -


hey trying value of devices camera / arcamera. far know there 1 function allows me access these arcamera traits. function here:

code:

 // gets called couple times when camera state changes    func session(_ session: arsession, cameradidchangetrackingstate camera: arcamera)     print("\(camera.eulerangles)")   } 

i've been thinking maybe using trickery putting repeating timer in function call value. can't call local selectors booted out. i'm more looking along lines of how function is:

func renderer(_ arenderer: scnscenerenderer, updateattime time: timeinterval) {  // gets called.  } 

i wonder if there way incorporate arcamera function.

if want continuously updates on camera state, implement arsessiondelegate.session(_:didupdate:):

class mydelegate: arsessiondelegate {    func session(_ session: arsession, didupdate frame: arframe) {     print("\(frame.camera)")   }    /* ... */ } 

the arframe object shall contain camera field necessary information.


if want know when tracking state changes, might want store state session(_:cameradidchangetrackingstate:) in field, , refer in rendering loop:

class mydelegate: scnscenerendererdelegate, arsessionobserver {    var camera: arcamera! = nil    func session(_ session: arsession, cameradidchangetrackingstate camera: arcamera) {     self.camera = camera   }    func renderer(_ renderer: scnscenerenderer, updateattime time: timeinterval) {     print("\(self.camera.trackingstate)")   }    /* ... more methods ... */ } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -