Whether you're using RealityKit or ARKit, you definitely need to use plane detection feature. If your app detects a plane in RealityKit, it will automatically track a plane target. And I should say that a detected plane doesn't move (you're using World Tracking, aren't you), but it may be extended.
AnchorEntity(.plane([.any], classification: [.any], minimumBounds: [0.5, 0.5]))
In case you're using a plane detection feature in ARKit/SceneKit, you must additionally implement session(_:didAdd:)
or renderer(_:didAdd:for:)
delegate method (because ARKit can't do a job automatically):
let config = ARWorldTrackingConfiguration()
config.planeDetection = [.horizontal, .vertical]
sceneView.session.run(config)
func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
guard let planeAnchor = anchors.first as? ARPlaneAnchor else { return }
}
For manual object placement use raycasting.
Also, you have to correctly position model's pivot point in 3D authoring app.