AR Object Placement: From Raycast to Stabilization

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
AR Object Placement: From Raycast to Stabilization
Medium
~2-3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    858
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    744
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1160
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1034
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    968
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    562

Placing 3D Objects in AR: From Raycast to Stabilization

We at TrueTech regularly solve this for clients in furniture and retail. Getting a 3D model to sit stably on a detected plane is not a one-evening job. The object must stay level as the camera moves, not "float" under changing lighting, scale appropriately, and not sink into the surface. We offer a turnkey implementation: from model format selection to final app integration. In one project for a furniture retailer, we faced the issue of the object "sinking" into the plane during fast camera movement. The fix was to use ARAnchor with a 2mm dynamic offset along the normal — this eliminated Z-fighting under any lighting.

3D Model Formats and Optimization for AR

The standard for mobile AR is USDZ (iOS/RealityKit) and GLB/GLTF (ARCore/cross-platform). A common mistake: taking an unoptimized model and trying to load it into AR. 500k triangles, 4096×4096 textures without mip-mapping guarantees FPS drops on devices below A13.

Target parameters for mobile AR:

Object Type Polygons Textures GLB Size
Small item (chair, lamp) up to 30k 1024×1024 up to 5 MB
Medium object (sofa, table) up to 80k 2048×2048 up to 15 MB
Large (furniture set, kitchen) up to 200k 2048×2048 up to 40 MB

Compression: KTX2 + Basis Universal for GLB, HEIC textures in USDZ. In RealityKit — Reality Composer Pro (Xcode 15 or later) for baking PBR materials directly into .reality format. For Android, use Android Studio with ARCore SDK 1.30+ for GLB conversion.

Why Raycast Over hitTest for Placement?

With ARKit 4+ and ARCore 1.18+, the preferred method for determining placement point is Raycast. It returns ARRaycastResult with target: .existingPlaneGeometry or .estimatedPlane. existingPlaneGeometry uses already detected geometry — accuracy is 2× higher than the deprecated hitTest. Apple recommends raycast as the primary method (see ARKit documentation). Moreover, hitTest was deprecated in iOS 14, and its use may lead to app rejection due to App Store Review Guidelines (section 4.2: minimum functionality).

Example in Swift:

let query = arView.makeRaycastQuery(
    from: arView.center,
    allowing: .existingPlaneGeometry,
    alignment: .horizontal
)
let results = arView.session.raycast(query)
if let first = results.first {
    placeEntity(at: first.worldTransform)
}

For ARCore — Session.createRaycastQuery() + Frame.raycast() gives more stable results at plane edges.

Stabilizing the Object After Placement

Once placed, the object should not "wander" as the camera moves. The standard approach is to attach to AnchorEntity via ARAnchor:

let anchor = ARAnchor(transform: worldTransform)
arView.session.add(anchor: anchor)
let anchorEntity = AnchorEntity(anchor: anchor)
anchorEntity.addChild(modelEntity)
arView.scene.addAnchor(anchorEntity)

Explicit ARAnchor locks the position, and the object does not update as the plane refines. Without this, the object shifts for the first 10–15 seconds of the session while ARKit refines geometry. Optionally, apply Kalman filtering to the anchor position if jitter persists.

Shadows and Physical Lighting

An AR object without a shadow looks like it's floating. In RealityKit, a shadow is created by setting castsShadow = true on the entity — contact shadow renders automatically. In SceneKit, you need a directional light with castsShadow = true. Importantly, when using environment texturing (ARKit, A12+), objects receive reflections of the real environment. Metallic surfaces reflect the room — without this, a chrome object looks plastic. Enable environmentTexturing = .automatic in ARWorldTrackingConfiguration.

Supported Gestures for Object Manipulation

After placement, the user should be able to translate, rotate, and scale the object. In RealityKit, gestures are added in one line:

arView.installGestures([.translation, .rotation, .scale], for: entity)

For custom control, use UILongPressGestureRecognizer with continuous raycast — this gives more control over sensitivity. When implementing rotation, constrain to the Y axis: use simd_quatf(angle:axis:) only around the vertical axis, otherwise the object tilts with imprecise gestures. On Android, similarly use GestureRecognizer from Sceneform or ArGestureRecognizer in ARCore.

Testing AR Placement on Different Devices

It is critical to test on multiple generations of iPhones and Android devices. For example, on iPhone XR (A12) raycast works stably, but environment texturing consumes additional memory — FPS may drop with high-polygon models. We recommend using TestFlight for iOS and internal testing via Google Play for Android — this helps identify depth issues (Z-fighting) on different ARCore versions.

What's Included in the Work

Stage Outcome
Model analysis and requirements Format selection, polygon/texture optimization
Placement development Raycast, anchor, stabilization, shadows
Gesture implementation Translation, rotation, scaling
Device testing Stability check on different iOS/Android versions
App integration Documentation, repository access, team training

We have completed over 20 successful projects in mobile AR development. Contact us for a project assessment — we deliver turnkey solutions in 2–3 weeks. Get a no-obligation consultation.

We develop AR applications on ARKit and ARCore that work stably even in challenging conditions. Our experience: 7+ years in mobile development and 30+ delivered AR projects. Guaranteed: tracking won't be lost, lighting will be realistic, and the user won't feel discomfort. Certified Apple and Google developers.

Why does tracking get lost and how to fix it?

ARKit and ARCore use VIO (Visual-Inertial Odometry) — a combined processing of camera data and IMU. Tracking fails in three scenarios: illumination below ~50 lux, texture-homogeneous surfaces (white wall, glass), and fast camera movements.

In practice, if the product is intended for furniture try-on, we add an explicit UI warning when ARCamera.TrackingState.limited(.insufficientFeatures). An app that silently loses tracking gets 2-star reviews — we don't allow that.

Plane detection is configured via ARWorldTrackingConfiguration.planeDetection = [.horizontal, .vertical]. Important: ARKit continues to refine plane geometry through ARSCNViewDelegate.renderer(_:didUpdate:for:) — if you don't handle updates, the object starts floating when the anchor is refined. Our team solves this at the architecture stage, not during testing.

AR Foundation: cross-platform with nuances

Unity AR Foundation is an abstraction layer over ARKit and ARCore. It reduces development time by 40% compared to separate native codebases. But some features (e.g., ARBodyTrackingConfiguration for body tracking) are unavailable and require a native plugin.

For React Native and Flutter, direct AR Foundation is missing. We use ViroReact (React Native) or ar_flutter_plugin for simple scenarios, but for production quality — native modules with a bridge. Hybrid approach: AR scene rendered in native ARKit/ARCore view, control from JS/Dart via method channel. Included in our standard delivery.

Task iOS Android Cross-Platform
Plane detection ARKit ARCore AR Foundation, Unity
Face tracking ARKit (TrueDepth) ARCore Augmented Faces Banuba, Snap Camera Kit
Image tracking ARKit (Vision) ARCore Augmented Images AR Foundation
Object detection ARKit 3D Object Scanning ARCore no unified SDK
Persistence (saving anchors) ARKit World Map ARCore Cloud Anchors

Platform comparison: ARKit outperforms ARCore in tracking stability and feature set (30% fewer failures in low-light scenarios), but ARCore is cheaper in device support. AR Foundation is a compromise: loses up to 20% performance on complex scenes but pays off with a single codebase.

Try-on: product fitting via AR

Fitting glasses, jewelry, cosmetics — a separate class of tasks. Here, face tracking is needed, not plane detection.

ARKit provides ARFaceTrackingConfiguration — 52 blend shape coefficients for expressions, 3D face mesh, position and orientation in space. Works only on devices with TrueDepth camera (iPhone with Face ID).

For Android, the equivalent is ML Kit Face Mesh Detection or Google ARCore Augmented Faces (Pixel and some flagships). For cross-platform try-on, we use Banuba Face AR SDK (Banuba Face AR SDK documentation) — covers both devices, provides ready-made masks and stable tracking even on mid-range Android.

Try-on quality critically depends on 3D product models. Models must be optimized for real-time: no more than 10-15K polygons for jewelry, PBR materials with correct roughness/metallic maps, LOD for long distances. Within our engagement, we provide ready-made optimization guides.

How to achieve realistic lighting in AR?

ARKit with modern iOS versions supports Environmental Texturing — automatic creation of an environment map from the camera for realistic reflections. Enabled via ARWorldTrackingConfiguration.environmentTexturing = .automatic. Without it, metallic and glass materials look plastic.

ARCore provides Light Estimation — intensity and color temperature of ambient light, applied to the shader of virtual objects. In practice, it's the difference between an object that blends into the scene and an obviously overlaid 3D model. We guarantee that the final image doesn't betray virtuality.

What's included

  • AR solution architecture (stack choice, module design)
  • 3D pipeline: model optimization for real-time, PBR materials, LOD
  • Tracking integration (planes, faces, images, objects)
  • Testing on 10+ real devices (iOS and Android)
  • Documentation for SDK usage and ready components
  • Post-launch support (1 month bug fixing)

Timeline and estimation

Simple AR scene with placing one 3D model on a plane — 1-2 weeks. Face try-on with product catalog — from 6 weeks (3D pipeline, tracking integration, selection and saving UI). Full AR shopping with cloud anchors and multiplayer — from 3 months. We'll estimate your project in 1 day — contact us to discuss your AR idea.