diff --git a/Assets/VRTK/Prefabs/Resources/Scripts/VRTK_SnapDropZone.cs b/Assets/VRTK/Prefabs/Resources/Scripts/VRTK_SnapDropZone.cs index b7e30b8e6..a2f069730 100644 --- a/Assets/VRTK/Prefabs/Resources/Scripts/VRTK_SnapDropZone.cs +++ b/Assets/VRTK/Prefabs/Resources/Scripts/VRTK_SnapDropZone.cs @@ -226,6 +226,24 @@ public virtual bool IsObjectHovering(GameObject checkObject) return currentValidSnapObjects.Contains(checkObject); } + /// + /// The GetHoveringObjects method returns a List of valid GameObjects that are currently hovering (but not snapped) in the snap drop zone area. + /// + /// The List of valid GameObjects that are hovering (but not snapped) in the snap drop zone area. + public virtual List GetHoveringObjects() + { + return currentValidSnapObjects; + } + + /// + /// The GetCurrentSnappedObejct method returns the GameObject that is currently snapped in the snap drop zone area. + /// + /// The GameObject that is currently snapped in the snap drop zone area. + public virtual GameObject GetCurrentSnappedObject() + { + return currentSnappedObject; + } + protected virtual void Awake() { if (Application.isPlaying) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 884bd2e6c..1acd2c198 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -391,6 +391,28 @@ The ValidSnappableObjectIsHovering method determines if any valid objects are cu The IsObjectHovering method determines if the given GameObject is currently howvering (but not snapped) in the snap drop zone area. +#### GetHoveringObjects/0 + + > `public virtual List GetHoveringObjects()` + + * Parameters + * _none_ + * Returns + * `List` - The List of valid GameObjects that are hovering (but not snapped) in the snap drop zone area. + +The GetHoveringObjects method returns a List of valid GameObjects that are currently hovering (but not snapped) in the snap drop zone area. + +#### GetCurrentSnappedObject/0 + + > `public virtual GameObject GetCurrentSnappedObject()` + + * Parameters + * _none_ + * Returns + * `GameObject` - The GameObject that is currently snapped in the snap drop zone area. + +The GetCurrentSnappedObejct method returns the GameObject that is currently snapped in the snap drop zone area. + ### Example `VRTK/Examples/041_Controller_ObjectSnappingToDropZones` uses the `VRTK_SnapDropZone` prefab to set up pre-determined snap zones for a range of objects and demonstrates how only objects of certain types can be snapped into certain areas.