Replace UltimateXR with HurricaneVR
This commit is contained in:
37
Assets/HurricaneVR/TechDemo/Scripts/DemoHolster.cs
Normal file
37
Assets/HurricaneVR/TechDemo/Scripts/DemoHolster.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using HurricaneVR.Framework.Core;
|
||||
using HurricaneVR.Framework.Core.Grabbers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HurricaneVR.TechDemo.Scripts
|
||||
{
|
||||
public class DemoHolster : HVRSocket
|
||||
{
|
||||
public override Vector3 GetTargetPosition(HVRGrabbable grabbable)
|
||||
{
|
||||
if (grabbable.TryGetComponent(out DemoHolsterOrientation orientation))
|
||||
{
|
||||
var offSet = -orientation.Orientation.localPosition;
|
||||
var delta = Quaternion.Inverse(orientation.Orientation.localRotation);
|
||||
offSet = delta * offSet;
|
||||
|
||||
offSet.x *= grabbable.transform.localScale.x;
|
||||
offSet.y *= grabbable.transform.localScale.y;
|
||||
offSet.z *= grabbable.transform.localScale.z;
|
||||
|
||||
return offSet;
|
||||
}
|
||||
|
||||
return base.GetTargetPosition(grabbable);
|
||||
}
|
||||
|
||||
public override Quaternion GetTargetRotation(HVRGrabbable grabbable)
|
||||
{
|
||||
if (grabbable.TryGetComponent(out DemoHolsterOrientation orientation))
|
||||
{
|
||||
return Quaternion.Inverse(orientation.Orientation.localRotation);
|
||||
}
|
||||
|
||||
return base.GetTargetRotation(grabbable);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user