public void PositionGameObjectRelativeToRoboy(GameObject gameObj, Vector3 relativePosition, bool createAnchor = false) { if (createAnchor) { var anchor = ARSessionManager.Instance.FloorPlane.CreateAnchor(ARSessionManager.Instance.FloorPlane.CenterPose); TemporaryAnchor.Create(anchor, false); gameObj.transform.parent = anchor.transform; } gameObj.transform.position = m_Roboy.transform.TransformPoint(relativePosition); }
private void SpawnRoboy() { if (RoboyManager.InstanceExists) { return; } var plane = ARSessionManager.Instance.FloorPlane; var anchor = plane.CreateAnchor(plane.CenterPose); TemporaryAnchor.Create(anchor, true); m_Roboy = Instantiate(RoboyPrefab, plane.CenterPose.position, plane.CenterPose.rotation); m_Roboy.transform.parent = anchor.transform; m_Roboy.Initialize(anchor); var face = Instantiate(UnityFacePrefab); face.gameObject.transform.SetParent(m_Roboy.ARAnchor.transform); SpawnPlanetSystems(); }