1
votes

I am working on an AR app for which I am placing one 3D model in front of the device without horizontal surface detection.

Based on this 3D model's transform, I creating ARAnchor object. ARAnchor objects are useful to track real world objects and 3D objects in ARKit.

Code to place ARAnchor:

ARAnchor* anchor = [[ARAnchor alloc] initWithTransform:3dModel.simdTransform]; // simd transform of the 3D model
[self.sceneView.session addAnchor:anchor];

Issue: Sometimes, I found that the 3D model starts moving in random direction without stopping.

Questions:

  1. Is my code to create ARAnchor is correct? If no, what is the correct way to create an anchor?
  2. Are there any known problems with ARKit where objects starts moving? If yes, is there a way to fix it?

I would appreciate any suggestions and thoughts on this topic.

EDIT:

I am placing the 3D object when the AR tracking state in normal. The 3D object is placed (without horizontal surface detection) when the user taps on the screen. As soon as the 3D model is placed, the model starts moving without stopping, even if the device is not moving.

2
Did you find a solution?YMonnier
No. This behavior is expected.Nimesh Chandramaniya
Did you try to fix this issue? Any alternative for this problemTommy

2 Answers

0
votes

You don't need an ARAnchor in fact, just set the position of the 3D object in front of the user.

0
votes

If the surface is not enough to determine a position, the object won’t attached to the surface. Find a plane with more textures and try again.