/*
* 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.Input
{
///
/// The data asset used by to pipe
/// data through the stack,
/// and contains controller state data.
///
[Serializable]
public class ControllerDataAsset : ICopyFrom
{
///
/// Is the data in this asset considered valid.
///
public bool IsDataValid;
///
/// Is the controller connected to the headset.
///
public bool IsConnected;
///
/// Is the controller being tracked by the headset.
///
public bool IsTracked;
///
/// Input state data such as button presses and axis state.
///
public ControllerInput Input;
///
/// The root pose of the controller, which represents the
/// canonical controller position. See
/// for information on how this pose was created.
///
public Pose RootPose;
///
/// Information about how was created, for example
/// whether it is the raw pose from tracking, or whether is has been
/// filtered or modified in the stack.
///
public PoseOrigin RootPoseOrigin;
///
/// The pointer pose for the controller, which is generally used as the
/// raycast source pose. See
/// for information on how this pose was created.
///
public Pose PointerPose;
///
/// Information about how was created, for example
/// whether it is the raw pose from tracking, or whether is has been
/// filtered or modified in the stack.
///
public PoseOrigin PointerPoseOrigin;
///
/// True if this controller is associated with the dominant hand,
/// as set by the system handedness.
///
public bool IsDominantHand;
///
/// This data object contains configuration data that is shuttled
/// through the stack.
///
public ControllerDataSourceConfig Config;
///
/// Copies the provided into the caller.
///
/// The source to copy from.
public void CopyFrom(ControllerDataAsset source)
{
IsDataValid = source.IsDataValid;
IsConnected = source.IsConnected;
IsTracked = source.IsTracked;
IsDominantHand = source.IsDominantHand;
Config = source.Config;
CopyPosesAndStateFrom(source);
}
///
/// Copies only pose and state data from a provided
/// into the caller.
///
/// The source to copy from.
public void CopyPosesAndStateFrom(ControllerDataAsset source)
{
Input = source.Input;
RootPose = source.RootPose;
RootPoseOrigin = source.RootPoseOrigin;
PointerPose = source.PointerPose;
PointerPoseOrigin = source.PointerPoseOrigin;
}
}
}