Initial Commit

This commit is contained in:
2025-07-04 20:33:06 +03:00
commit 8f09347ae0
9219 changed files with 2447903 additions and 0 deletions
@@ -0,0 +1,59 @@
/*
* 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 System.Collections.Generic;
using UnityEngine;
namespace Meta.XR.BuildingBlocks.Editor
{
public class HandTrackingBlockData : BlockData
{
protected override List<GameObject> InstallRoutine()
{
var cameraRig = OVRProjectSetupUtils.FindComponentInScene<OVRCameraRig>();
if (cameraRig == null)
{
throw new InvalidOperationException(
"The Hand Tracking BB cannot be installed without a camera rig present in the scene.");
}
var leftHand = Instantiate(Prefab, Vector3.zero, Quaternion.identity);
leftHand.SetActive(true);
leftHand.name = $"[BB] {BlockName} left";
leftHand.transform.parent = cameraRig.leftHandAnchor;
leftHand.GetComponent<OVRHand>().HandType = OVRHand.Hand.HandLeft;
leftHand.GetComponent<OVRSkeleton>().SetSkeletonType(OVRSkeleton.SkeletonType.HandLeft);
leftHand.GetComponent<OVRMesh>().SetMeshType(OVRMesh.MeshType.HandLeft);
var rightHand = Instantiate(Prefab, Vector3.zero, Quaternion.identity);
rightHand.SetActive(true);
rightHand.name = $"[BB] {BlockName} right";
rightHand.transform.parent = cameraRig.rightHandAnchor;
rightHand.GetComponent<OVRHand>().HandType = OVRHand.Hand.HandRight;
rightHand.GetComponent<OVRSkeleton>().SetSkeletonType(OVRSkeleton.SkeletonType.HandRight);
rightHand.GetComponent<OVRMesh>().SetMeshType(OVRMesh.MeshType.HandRight);
return new List<GameObject> {leftHand, rightHand};
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 484800a18d70d2d4386ee3f42ef24113
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,87 @@
/*
* 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.Linq;
using UnityEditor;
namespace Meta.XR.BuildingBlocks.Editor
{
[InitializeOnLoad]
internal static class HandTrackingSetupRules
{
static HandTrackingSetupRules()
{
OVRProjectSetup.AddTask(
level: OVRProjectSetup.TaskLevel.Required,
group: OVRProjectSetup.TaskGroup.Compatibility,
isDone: _ =>
{
if (!HandTrackingBuildingBlockExists())
{
return true;
}
var projectConfig = OVRProjectConfig.CachedProjectConfig;
return projectConfig.handTrackingSupport != OVRProjectConfig.HandTrackingSupport.ControllersOnly;
},
message: $"Hand Tracking must be enabled in OVRManager when using its {Utils.BlockPublicName}",
fix: _ =>
{
var projectConfig = OVRProjectConfig.CachedProjectConfig;
projectConfig.handTrackingSupport = OVRProjectConfig.HandTrackingSupport.ControllersAndHands;
OVRProjectConfig.CommitProjectConfig(projectConfig);
},
fixMessage: $"Enable Hand Tracking must be enabled in OVRManager"
);
OVRProjectSetup.AddTask(
level: OVRProjectSetup.TaskLevel.Required,
group: OVRProjectSetup.TaskGroup.Compatibility,
isDone: _ =>
{
if (!HandTrackingBuildingBlockExists())
{
return true;
}
var projectConfig = OVRProjectConfig.CachedProjectConfig;
return projectConfig.handTrackingVersion == OVRProjectConfig.HandTrackingVersion.V2;
},
message: $"Hand Tracking V2 is required when using the Hand Tracking {Utils.BlockPublicName}",
fix: _ =>
{
var projectConfig = OVRProjectConfig.CachedProjectConfig;
projectConfig.handTrackingVersion = OVRProjectConfig.HandTrackingVersion.V2;
OVRProjectConfig.CommitProjectConfig(projectConfig);
},
fixMessage: $"Select Hand Tracking V2"
);
}
private static bool HandTrackingBuildingBlockExists()
{
var handObjects = OVRProjectSetupUtils.FindComponentsInScene<OVRHand>();
return handObjects.Any(hand => hand.GetComponent<BuildingBlock>());
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 51cdf386012239f4b89597171ff0c3f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: