1
votes

I'm actualy developing an AR application on xCode with ARKit.

I have my iPad who is on a particular orientation and when I add a SCNode on (0,0,0) to my SCNScene with a ARWorldTrackingSessionConfiguration it appears in front of the camera when the iPad is perpendicular to the ground like so : The iPad is perpendicular to the ground and the 3D object is at (0,0,0)

The iPad is perpendicular to the ground and the 3D object is at (0,0,0)

I would like to have my SCNode to appears directly on the iPad screen when I launch the ARScene like this :

The iPad is oriented in direction to the flower pot and i had to set the coordinates manually

The iPad is oriented in direction to the flower pot and i had to set the coordinates manually

How can i do that ? I imagine i would have to do something like a translation of coordinates but I don't know how to do that. And if it can help, i can have the distance between the camera and the flower pot

Thanks in advance ! :)

1

1 Answers

1
votes

You need to pass the coordinates of the object in a SCNMatrix4 form as follows:

let translationMatrix = SCNMatrix4Translate(theNode.worldTransform, 0.1, 0.1, 0.1) //tx, ty, tz are translations in each axis i and then theNode.transform = translation matrix