I want to place placement pose indicator on both vertical and horizontal plane in Ar foundation
what i am trying is working on horizontal plane only, here is code snippet...
Please help to me to find out solution:-- Thanks
private void UpdatePlacementIndicator() { if (placementPoseIsValid) { placementIndicator.SetActive(true); //TrackableId planeHit_ID = hits[0].trackableId; //ARPlane planeHit = arPlaneManager.GetPlane(planeHit_ID); //Quaternion q = Quaternion.FromToRotation(planeHit.transform.up, placementIndicator.transform.up); placementIndicator.transform.SetPositionAndRotation(placementPose.position, placementPose.rotation); // placementIndicator.transform.rotation = q * transform.rotation; } else { placementIndicator.SetActive(false); } } Pose pos; List hits; private void UpdatePlacementPose() { var screenCenter = Camera.current.ViewportToScreenPoint(new Vector3(0.5f, 0.5f));
hits = new List();
raycastManager.Raycast(screenCenter, hits, TrackableType.All);
placementPoseIsValid = hits.Count > 0;
if (placementPoseIsValid) {
placementPose = hits[0].pose;
var cameraForward = Camera.current.transform.forward;
var cameraBearing = new Vector3(cameraForward.x,0, cameraForward.z).normalized;
placementPose.rotation = Quaternion.LookRotation(cameraBearing);
} }