C’est très simple ! Commencez par organiser correctement la hiérarchie de votre caméra.

Votre Rig (GameObject principal) ├── CoefMul (utilisé pour le coefficient multiplicateur ) Multiplicateur de mouvement └── Camera
Ajoutez le script **Syn.cs**Sync sur votre Rig. Il se charge d’appliquer automatiquement les offsets de position et de rotation pour aligner correctement le joueur dans la zone de free-roaming.

Une fois le script ajouté, vous obtiendrez la bonne position dans votre expérience VR, mais sans délimitation physique de la salle.
Deux options s’offrent à vous : soit créer votre propre délimitation
NewSpatial.jsonVoici un script de démonstration que vous pouvez utiliser pour comprendre le fonctionnement du spatial system dans Varonia Back Office :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VaroniaBackOffice;
public class SyncOnStart : MonoBehaviour
{
public Transform CameraRig; // Root of the XR rig
IEnumerator Start()
{
// Wait until Config is ready
yield return new WaitUntil(() => Config.Spatial != null);
// Create boundaries
foreach (var boundary in Config.Spatial.Boundaries)
{
GameObject lineObj = new GameObject("Boundary_Line");
lineObj.transform.SetParent(CameraRig, false);
LineRenderer line = lineObj.AddComponent<LineRenderer>();
line.loop = true;
line.useWorldSpace = false;
line.startWidth = 0.05f;
line.endWidth = 0.05f;
line.alignment = LineAlignment.View;
line.textureMode = LineTextureMode.Stretch;
line.textureScale = new Vector2(1, 1);
line.positionCount = boundary.Points.Count;
line.startColor = Color.red;
line.endColor = Color.red;
// Create default red material
Material mat = new Material(Shader.Find("Sprites/Default"));
mat.color = Color.red;
line.material = mat;
for (int i = 0; i < boundary.Points.Count; i++)
{
var point = boundary.Points[i];
line.SetPosition(i, new Vector3(point.x, point.y + 0.05f, point.z));
}
// Create obstacles
foreach (var obstacle in boundary.Obstacles)
{
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.localScale = new Vector3(0.4f, 2f, 0.4f);
cube.transform.position = obstacle.Position.asVec3();
cube.transform.SetParent(CameraRig, false);
}
}
}
}
<aside> ℹ️ Ce script suppose que vous avez un GameObject parent qui contient le rig VR** (par exemple : le "Camera Rig" de SteamVR).
</aside>