/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * Licensed under the Oculus SDK License Agreement (the "License"); * you may not use the Oculus SDK except in compliance with the License, * which is provided at the time of installation or download, or which * otherwise accompanies this software in either electronic or hard copy form. * * You may obtain a copy of the License at * * https://developer.oculus.com/licenses/oculussdk/ * * Unless required by applicable law or agreed to in writing, the Oculus SDK * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using UnityEngine; namespace Oculus.Interaction.Grab.GrabSurfaces { /// /// This interface defines the methods needed to use grab surfaces, such as finding the nearest poses at /// the surface to a given set of parameters and duplicating and mirroring the surface. /// /// /// For a canonical example of an implementation of this interface, see . /// public interface IGrabSurface { /// /// Finds the Pose at the surface that is the closest to the given pose. /// /// The root pose to find the nearest to. /// The best found pose at the surface.< /// Weight used to decide which target pose to select /// Reference transform to measure the poses against /// The score indicating how good the found pose was, -1 for invalid result. [Obsolete("Use " + nameof(CalculateBestPoseAtSurface) + " with offset instead")] GrabPoseScore CalculateBestPoseAtSurface(in Pose targetPose, out Pose bestPose, in PoseMeasureParameters scoringModifier, Transform relativeTo); /// /// Finds the Pose at the surface that is the closest to the given pose. /// /// The root pose to find the nearest to. /// The offset from the root, for accurate scoring /// The best found pose at the surface.< /// Weight used to decide which target pose to select /// Reference transform to measure the poses against /// The score indicating how good the found pose was, -1 for invalid result. GrabPoseScore CalculateBestPoseAtSurface(in Pose targetPose, in Pose offset, out Pose bestPose, in PoseMeasureParameters scoringModifier, Transform relativeTo); /// /// Finds the Pose at the surface that is the closest to the given ray. /// /// Ray searching for the nearest snap pose /// The best found pose at the surface. /// Reference transform to measure the poses against /// True if the pose was found bool CalculateBestPoseAtSurface(Ray targetRay, out Pose bestPose, Transform relativeTo); /// /// Method for mirroring a Pose around the surface. Different surfaces will prefer mirroring /// along different axes. /// /// /// For example, mirrors along its "left-right" axis, whereas /// does not support mirroring and simply returns the /// provided . /// /// The Pose to be mirrored. /// Reference transform to mirror the pose around /// A new pose mirrored at this surface. Pose MirrorPose(in Pose gripPose, Transform relativeTo); /// /// Creates a new IGrabSurface under the selected gameobject /// that is a mirror version of the current. /// /// The gameobject in which to place the new IGrabSurface. /// A mirror of this IGrabSurface. IGrabSurface CreateMirroredSurface(GameObject gameObject); /// /// Creates a new IGrabSurface under the selected gameobject /// with the same data as this one. /// /// The gameobject in which to place the new IGrabSurface. /// A clone of this IGrabSurface. IGrabSurface CreateDuplicatedSurface(GameObject gameObject); } }