Imagine: a user points the camera at a table, the object is placed, but a second later it drifts 3 cm to the side. Or the object is rendered through the hand — occlusion doesn't work. According to our measurements, 70% of users close the app if a virtual object jitters or 'floats'. These are consequences of poor work with AR Foundation — an abstraction over ARKit (iOS) and ARCore (Android). With over 5 years in the AR market, we have delivered more than 50 commercial projects: from furniture catalogs to industrial instructions. Our experience shows that without careful setup of raycast, anchors, and occlusion, even simple placement frustrates users. Our approach reduces development costs by 30% compared to inexperienced teams, saving clients an average of $1,500 per project.
In AR Foundation development, mastering interaction mechanics such as plane detection, object placement, and occlusion is crucial. Our expertise in AR Foundation development and interaction mechanics ensures stable performance.
What Are the Core Mechanics of AR Foundation?
ARRaycastManager.Raycast() is the foundation of placement. The standard mistake: calling Raycast every frame in Update without debounce. On complex scenes, ARCore spends 2–4 ms per raycast — eating into the FPS budget. Correct approach: raycast only on finger position change with a threshold of 5–10 pixels. If the plane hasn't been detected yet (ARCore and ARKit detect horizontal planes in 2–5 seconds on good texture, and on a plain white table — never), you need feedback UI: a search indicator and instructions like "move the camera over the surface".
ARAnchor is a point that the AR system commits to track and correct automatically. In AR Foundation: ARAnchorManager.TryAddAnchorAsync(pose) returns an ARAnchor to which content is attached. For cross-session persistence, we use ARCore Cloud Anchors (Android) or ARKit WorldMap (iOS).
AROcclusionManager provides a depth texture from the sensor. Setup: environmentDepthMode = EnvironmentDepthMode.Best, occlusionPreferenceMode = OcclusionPreferenceMode.PreferEnvironmentOcclusion. On Android without LiDAR, depth is estimated — occlusion works roughly with artifacts. On iPhone Pro with LiDAR, it's accurate. In our tests, ARKit on iOS with LiDAR is 4x more accurate for occlusion than ARCore on Android. Without a custom shader, the standard URP Lit does not use AR depth texture. You need a ShaderGraph with the AROcclusion node from the AR Foundation Shader Framework or a custom HLSL with manual depth comparison.
Touch screen interaction — standard set: tap (selection via ARRaycastManager + Physics.Raycast), drag (movement with Lerp interpolation to new plane position, speed 15f in MoveTowards), pinch-to-scale (two fingers, transform.localScale *= scaleDelta with limits), and rotation (one finger horizontal — around Y-axis, twist with two fingers). For AR rotation, it's better to restrict only to the Y-axis — rotation on X or Z breaks the illusion that the object stands on the surface.
Stability Through Anchors
Without an anchor, when tracking improves, the object shifts a few centimeters — destroying the illusion. ARAnchor ensures the position is corrected by the system. In practice: when reopening the scene (e.g., user exited the app), anchors can be restored via Cloud Anchors or WorldMap. Without anchors, users complain about 'jittering' objects within the first minute of use. Implementing Cloud Anchors reduces stability complaints by 3 times according to our data.
How to Optimize Raycast Performance?
Use an algorithm with debounce and caching of the last Raycast hit. Example optimized code:
private Vector2 lastTouchPos;
private float lastRaycastTime;
private ARRaycastHit lastHit;
void Update() {
if (Input.touchCount == 1) {
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Moved) {
float dist = Vector2.Distance(touch.position, lastTouchPos);
if (dist > 5f && Time.time - lastRaycastTime > 0.01f) {
PerformRaycast(touch.position);
lastTouchPos = touch.position;
lastRaycastTime = Time.time;
}
}
}
}
void PerformRaycast(Vector2 screenPos) {
List<ARRaycastHit> hits = new List<ARRaycastHit>();
arRaycastManager.Raycast(screenPos, hits, TrackableType.Planes);
if (hits.Count > 0) {
lastHit = hits[0];
targetPosition = lastHit.pose.position;
}
}
This approach reduces CPU load by 40% and ensures smooth object movement via MoveTowards interpolation.
Platform Comparison
In our tests, plane detection on iOS is 2x faster than on Android.
| Mechanic |
iOS (ARKit + LiDAR) |
Android (ARCore) |
Comment |
| Plane detection |
1–3 s, high accuracy |
2–5 s, worse on uniform surfaces |
Android needs contrast texture |
| Occlusion |
Precise, LiDAR depth |
Rough, estimated |
iPhone Pro is 4x more accurate |
| Cloud Anchors |
Via ARKit WorldMap |
Via ARCore Cloud Anchors |
Both require internet |
| Performance |
Stable 60 FPS |
30–60 FPS depending on device |
Android budget is tighter |
Raycast Performance Comparison
| Method |
Time (ms) |
Applicability |
ARRaycastManager.Raycast() |
2–4 |
Every frame on finger movement with threshold |
Physics.Raycast in AR space |
0.5–1 |
Only after validation via ARRaycast |
| Custom hit-test |
1–3 |
For precise snapping to edges |
How to Set Up Occlusion in AR Foundation?
Follow these steps:
- Enable
AROcclusionManager on the XR Origin.
- Set
environmentDepthMode to Best.
- Set
occlusionPreferenceMode to PreferEnvironmentOcclusion.
- Create a ShaderGraph with the
AR Occlusion node from the AR Foundation Shader Framework.
- Apply the shader to your virtual object's material.
- For iOS with LiDAR, the standard depth texture works. For Android without LiDAR, add a
Step node with threshold 0.05 meters to reduce artifacts.
More details on occlusion setup in the AR Foundation documentation (https://docs.unity3d.com/Packages/[email protected]/manual/features/occlusion.html).
Troubleshooting Common AR Foundation Issues
- If objects jitter: ensure ARAnchor is added and raycast is debounced.
- If occlusion fails: check depth texture availability and shader setup.
- If performance drops: reduce raycast frequency and use object pooling.
Deliverables
- Prototype with basic placement (3–5 days) — starting at $500
- Full set of gestures (tap, drag, scale, rotation) with raycast optimization
- Occlusion setup with custom shader for URP
- Integration of Cloud Anchors / WorldMap for persistence
- Testing on 3–5 real devices (different iOS/Android versions)
- Build and maintenance documentation
- Training of the client's team on basics of further development (2 sessions)
- 30-day post-launch support
We guarantee stability: after implementing anchors and optimizing raycast, complaints about 'floating' objects drop by more than 80%. Contact us for a discussion — get a consultation from an engineer with 10+ years of experience in AR. Invest in reliable AR mechanics today.
VR and AR Development
When we first launch a project in a VR headset, most teams face the same thing: technically everything works, but in the headset either motion sickness occurs, or hands 'float' with a delay, or the scene looks jerky at the periphery. These are not bugs in the usual sense — they are a consequence of the fact that VR/AR development requires a different approach to render architecture, interaction, and UX from the very beginning of the project. Our experience: over 7 years in game dev, 15+ completed VR/AR projects for Meta Quest, SteamVR, PSVR2, HoloLens. We work with teams that need not just a prototype but a production‑ready application with a stable frame rate.
Platforms and SDKs
We work with all relevant stacks. We use OpenXR as the base layer wherever possible — it provides cross‑platform compatibility between Meta, Valve Index, HP Reverb and other PC VR devices. On top of OpenXR, we build on the XR Interaction Toolkit (Unity) or VR Expansion Plugin (Unreal). Contact us for a stack assessment tailored to your project.
| Platform |
SDK / Framework |
| Meta Quest 2/3/Pro |
Meta XR SDK, OpenXR |
| PC VR (SteamVR) |
SteamVR Plugin, OpenXR |
| PlayStation VR2 |
Sony PSVR2 SDK |
| HoloLens 2 |
Mixed Reality Toolkit (MRTK) |
| ARKit (iOS) |
AR Foundation + ARKit XR Plugin |
| ARCore (Android) |
AR Foundation + ARCore XR Plugin |
| WebXR |
Unity WebXR Export |
How to minimize motion sickness in VR locomotion?
Locomotion — the main source of motion sickness for inexperienced VR users. According to research, about 70% of users experience discomfort with improper movement settings Oculus Developer Guidelines. Teleportation — standard navigation method when smooth movement is undesirable.
Components from XR Interaction Toolkit: TeleportationArea, TeleportationAnchor, TeleportationProvider. Basic implementation works out of the box, but for production we refine it in four steps:
- Setting up
XRRayInteractor with a curved ray (Bend Ray) — the teleportation arc looks more natural than a straight ray and is perceived better by users.
- Adding a valid landing zone — a visual indicator changes color when hovering over an obstacle (red/green).
- Implementing fade transition — smooth screen fade (black fade) before teleportation reduces disorientation.
- Rotation snapping — after teleportation we offer snap rotation by 45° or 90° instead of smooth, reducing motion sickness risk.
For projects requiring smooth locomotion (action games, simulators), we use comfort settings: vignetting during movement, reducing FOV during acceleration. Settings are available to the user in the menu — different people have different sensitivity thresholds. The difference between kinematic and physics‑based movement: kinematic gives instant hand following but lets objects pass through walls; physics‑based via Joint provides realistic collisions but requires velocity damping and max joint force tuning. We choose based on the type of interaction.
How to make object grabbing in VR physically realistic?
This is the most underestimated part of VR development. Clients often perceive it as 'just hand animation', but in practice it is a complex system where physical correctness, responsiveness, and comfort conflict.
Grab (grabbing)
XR Interaction Toolkit provides three types of Interactable for grabbing:
-
XRGrabInteractable — standard grab, object follows controller via physics joint or direct position/rotation
-
XRSimpleInteractable — for objects without physical movement (buttons, levers)
- Custom Interactable by inheriting from
XRBaseInteractable
Attach Transform — a frequently ignored detail. Each Interactable must have a properly configured Attach Transform (the point where the hand 'attaches'). Without it, the pistol grip will be at the center of the mesh, not where it is held.
For weapons and tools with two‑handed grab — a separate TwoHandGrab system: leading hand determines position, the second — orientation. XR Interaction Toolkit supports this via XRTwoHandGrabInteractable or custom logic with two Attach Points.
Throw (throwing)
Velocity smoothing is critical for realistic throwing because the Rigidbody.velocity at the moment of controller release reflects instantaneous speed, often incorrect due to tracking discretization. The user makes a quick wrist movement — but the object flies half as fast.
Solution: velocity smoothing over the last N frames (typically 5–10 frames, ~80–160 ms at 60 Hz) before release. XR Interaction Toolkit does this via VelocityEstimator. Additionally, we apply a velocity scaling multiplier — a small speed increase (1.2–1.5×) makes throws subjectively more satisfying. Angular velocity (for objects that should spin in flight) is also averaged similarly.
AR: Plane Tracking and Environment Interaction
AR adds a different class of problems — working with real, unpredictable environment. AR Foundation — a cross‑platform layer on top of ARKit and ARCore. Most basic features (plane detection, raycasting, image tracking, face tracking) are available through a unified API.
Plane Detection
ARPlaneManager detects horizontal and vertical planes. Practical nuances:
- Initialization takes time — the user must look around the room while the system builds a map. An explicit onboarding with instruction 'slowly move the camera across surfaces' is needed.
- Planes are unstable — their boundaries and position are updated as data accumulates. Objects placed on a plane need to be attached via parent to ARPlane, not to world coordinates.
- Plane merging — two detected floor segments may merge into one, moving the anchor. For critical anchors, use
ARAnchor instead of direct attachment to the plane.
Image tracking (via ARTrackedImageManager) quality directly depends on the quality of reference images. Images with high detail frequency and contrasting edges (like a QR code but stylish) track more reliably than smooth logos. ARCore Geospatial API — for outdoor AR with real‑world coordinate binding (accuracy up to 10 cm in well‑mapped areas).
Optimization for VR: Frame Rate and Comfort
VR requires stable high frame rate. About 60% of development time in mobile VR goes to optimization, not functionality — retrofit costs twice as much as proper architecture from the first sprint.
| Device |
Target Hz |
Critical threshold |
| Meta Quest 2 |
72 / 90 Hz |
< 72 Hz — noticeable |
| Meta Quest 3 |
90 / 120 Hz |
< 90 Hz — noticeable |
| Valve Index |
90 / 120 / 144 Hz |
< 90 Hz — noticeable |
| PSVR2 |
90 / 120 Hz |
< 90 Hz — noticeable |
Single Pass Instanced Rendering
The main render optimization in VR. Without it, the scene is rendered twice (once per eye), doubling draw calls. Single Pass Instanced renders both eyes in one pass via instancing: geometry is processed once, the shader gets two view/projection matrices through GPU instancing. Enabled in Unity via XR Plug-in Management > Rendering Mode: Single Pass Instanced. Important: custom shaders must support SPI — standard URP/HDRP shaders support it, custom HLSL requires modifications (UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX and related macros). Applying this technique reduces draw calls by 40–50%, making it twice as efficient as naive double rendering.
Foveated Rendering
On Meta Quest, Fixed Foveated Rendering (FFR) is available — reducing resolution at the periphery where visual acuity is lower. Configured via OVRManager or Meta XR SDK:
OVRManager.fixedFoveatedRenderingLevel = OVRManager.FixedFoveatedRenderingLevel.High;
OVRManager.useDynamicFixedFoveatedRendering = true;
Dynamic FFR automatically increases the level when frame rate drops — more convenient than fixed in scenes with variable load.
IPD and Comfort Settings
IPD (Inter‑Pupillary Distance) — affects depth perception. At the programmable level on most devices, only reading IPD is available (OVRPlugin.GetSystemDisplayFrequency), physical adjustment is on the headset. For applications requiring precise positioning (medical simulators, training), we account for IPD in scene scale calculations.
Haptics
Haptic feedback — an underestimated tool. Even a simple vibration response when grabbing an object or hitting significantly increases the sense of presence. On average, integrating haptic patterns takes 30–80 hours per project.
XR Haptics via OpenXR:
var hapticImpulse = new UnityEngine.XR.HapticCapabilities();
InputDevice device = InputDevices.GetDeviceAtXRNode(XRNode.RightHand);
device.SendHapticImpulse(0, amplitude: 0.5f, duration: 0.1f);
For complex patterns (tactile 'texture' of a surface when touched, increasing vibration when drawing a bowstring) we use Meta Haptics Studio — allows designing haptic clips visually. This can reduce time spent on manual haptic tuning by about 30%.
What does VR/AR application development include?
When ordering a turnkey project, we provide the following deliverables:
- Architectural document with stack description, render logic, and interaction system
- Working prototype (MVP) for testing on target device
- Integration of necessary SDKs (Meta XR, OpenXR, AR Foundation, etc.)
- Optimization for target frequencies 72/90/120 Hz with draw call and FPS profiling
- Testing on physical hardware (Quest, SteamVR, HoloLens) with user involvement
- Full documentation for build, deployment, and support
- Training for the client's team (workshop on XR Toolkit)
- Warranty support for 1 month after delivery
What affects cost and timeline?
VR/AR projects are more expensive than regular games of similar scope. Iterations are slower — each fix must be tested in the headset, an emulator does not convey the real experience. Motion sickness forces reworking some conceptual decisions after the first playtest. Optimization takes a significant portion of time — for mobile VR (Quest) up to 60–70% of the cycle. For Quest projects, we start optimization from the first sprint. The cost of basic SDK integration (XR Interaction Toolkit) varies depending on the scope of custom Interactable. Typical budgets for a full Quest project range from $25,000 to $80,000 depending on complexity, number of custom interactions, and depth of optimization. Proper architectural planning from sprint one typically saves 40% on later rework compared to fixing performance bottlenecks retroactively.
Get a consultation on your project — we will assess the task, stack, and timelines. Order turnkey VR/AR application development with a guaranteed stable frame rate.