So i was trying to create a basic AR experimental game where I just spawn a cube and see how it goes, and apparently the cube follows the camera for some reason, at least when it comes to distance, where for some reason when i tried to go away from it, it follows, i tried placing Anchor management on the Session Origin and the Anchor on the cube, but nothing changed, is there anything i need to do to solve this?
How do you spawn it?
Make sure both 6DoF tracking is enabled and it’s not a child of the camera
no it is not a child of the camera, since it was never there at the first place, as for how it was spawned, I instantiate it, like this:
public void CreateCubeEntity()
{
if (_conjureKit.GetState() != State.Calibrated)
return;
Vector3 position = arCamera.transform.position + arCamera.transform.forward * 6.5f;
Quaternion rotation = Quaternion.Euler(0, arCamera.transform.eulerAngles.y, 0);
Pose entityPos = new Pose(position, rotation);
Debug.Log("Adding cube");
_conjureKit.GetSession().AddEntity(
entityPos,
onComplete: entity => CreateCube(entity),
onError: error => Debug.Log(error));
}
private void CreateCube(Entity entity)
{
if (entity.Flag == EntityFlag.EntityFlagParticipantEntity) return;
var pose = _conjureKit.GetSession().GetEntityPose(entity);
Instantiate(cube, pose.position, pose.rotation);
}
Also currently im using the 2021 version of Unity, and I am unable to find a way to enable 6DoF tracking no matter where i find. So i cant be sure about 6DoF, sorry.
ARCore/ARKit/AR Foundation all have 6DoF by default.
Just make sure AR is actually functioning. And know that if you face a purely white wall it doesn’t have enough information to do tracking
That is not the case im facing since i am facing a office desk, i can turn away from it, but if i were to walk backwards away from it, it just follows
The cube is just very far away I think. Move it to like 10cm in front of the camera (0.1 units in Unity)