Skip to content

Latest commit

 

History

History
76 lines (56 loc) · 1.88 KB

File metadata and controls

76 lines (56 loc) · 1.88 KB

ARFoundationExtensions

CenterOfScreen

Returns a Vector2 that is half the screen's current width and height.

Debug.Log(CenterOfScreen);

RaycastToPlane

Raycast from Vector2 screen point. Returns true if raycast collides with a plane. Also returns collision Pose and ARPlane.

if (RaycastToPlane(CenterOfScreen, raycastManager, planeManager, out var pose, out var plane)) {
    Debug.Log(pose.position);
    Debug.Log(plane.alignment);
}

IsLookingAtPlane

Raycast from center of screen. Returns true if raycast collides with a plane. Optionally returns collision Pose and ARPlane.

if (IsLookingAtPlane(raycastManager, planeManager, out var pose, out var plane)) {
    Debug.Log("Plane is visible (and in the center of the screen).");
}
if (IsLookingAtPlane(raycastManager, planeManager, out var pose)) {
    Debug.Log("Plane is visible (and in the center of the screen).");
}
if (IsLookingAtPlane(raycastManager, planeManager)) {
    Debug.Log("Plane is visible (and in the center of the screen).");
}

HasTouchedPlane

Raycast from input position of screen. Returns true if raycast collides with a plane. Optionally returns collision Pose and ARPlane.

if (HasTouchedPlane(raycastManager, planeManager, out var pose, out var plane)) {
    Debug.Log("Plane has been touched.");
}
if (HasTouchedPlane(raycastManager, planeManager, out var pose)) {
    Debug.Log("Plane has been touched.");
}
if (HasTouchedPlane(raycastManager, planeManager)) {
    Debug.Log("Plane has been touched.");
}

SetActiveStateOfPlaneVisuals

Disables/enables all ARPlane gameObjects.

planeManager.SetActiveStateOfPlaneVisuals(false); // disables ARPlane gameObjects
planeManager.SetActiveStateOfPlaneVisuals(true); // enables ARPlane gameObjects