-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
startAngle not working when controlMethod = motion #36
Comments
If controlMethod = touch everything is correct |
related to #31 |
Do we have any updates on this case? I need it too, I am not sure how to implement such a case .. |
Here is what I did a while ago: class PanoramaController: UIViewController {
lazy var loctionManager: CLLocationManager = {
let locationManager = CLLocationManager()
locationManager.delegate = self
return locationManager
}()
private lazy var panoramaView: CTPanoramaView = {
let view = CTPanoramaView()
view.compass = compassView // create CTPieSlideView somewhere in this ViewController if needed
return view
}()
var northAngle: Float? {
didSet {
if let newValue = northAngle, oldValue == nil {
// this will only set once
// print("set start angle to: \(newValue)")
panoramaView.startAngle = newValue // -.pi / 2
panoramaView.controlMethod = .motion
}
}
}
}
/*
use location manager delegate to find and set north and calibrate panorama view
*/
extension PanoramaController: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) {
// calculate + reset north
let heading = newHeading.magneticHeading
let normalisedHeading = Double((Int(heading) - 270 + 360) % 360)
let radian = normalisedHeading * .pi / 180
let radianPi = radian / .pi
// center image (image is centered at -0.5 * pi)
let imageCenter = 3.5 * .pi
let centeredRadian = imageCenter - radian
self.northAngle = Float(centeredRadian) // Float(imageOffset)
manager.stopUpdatingHeading()
}
} Hope I could help. |
I've added your code to my app, I am able to get the print out of the new value (I must added a |
I don't have much time. |
Great, I was able to get both motion and touch support from the PR, but still, for spherical panorama, there is no chance of getting the offset based on device heading :( |
@nayooti sorry for bothering you again. Can you share the code from the CTPanoramaView as well? I think I've just missing some little stuff to be able to make it work. I am not sure how to add a offset to the X axis only... It will be very very helpful and kind. Thanks! |
You should have find an invitation for a project that includes sample code. |
Yes thank you!! |
when setting controlMethod = motion , despite any value we put on our startAngle, our camera node keeps the same angle,
The text was updated successfully, but these errors were encountered: