Reputation: 1389
Hi I want to place model in specific direction say related to north pole .After detecting the plane when I touch the screen the models will be placed but the models must be pointing towards north pole.I believe we need to take device's Gyroscope and find north pole ,then place the models.If the north pole is diagonal from where I am standing ,then when I place the models will be kept diagonally.So I have to add or subtract that much degrees to make the model straight.So where do I start from.
Upvotes: 0
Views: 417
Reputation: 385
I would set the alignment of the axes when you first configure your ARKit session so that they are aligned with gravity and heading. This is described here. So, after you do:
let configuration = ARWorldTrackingConfiguration()
configuration.worldAlignment = ARWorldTrackingConfiguration.WorldAlignment.gravityAndHeading
scnView.session.run(configuration)
It'll line up the axes with Magnetic North (note, this is slightly different from true north pole) . Now, if you place a model at (0,0,-1)
, it'll show up 1 meter in the direction of Magnetic North
Upvotes: 1