mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2026-02-04 09:06:10 +00:00
mass commit of laziness
This commit is contained in:
parent
ce992c70ee
commit
6d4fc549d9
167 changed files with 5471 additions and 675 deletions
|
|
@ -4,7 +4,44 @@ namespace ABI_RC.Core.Player.Interaction.RaycastImpl
|
|||
{
|
||||
public class CVRPlayerRaycasterTransform : CVRPlayerRaycaster
|
||||
{
|
||||
public CVRPlayerRaycasterTransform(Transform rayOrigin) : base(rayOrigin) { }
|
||||
#region Proximity Grab
|
||||
|
||||
public const float ProximityGrabRadiusScaleDefault = 0.1f;
|
||||
private float _proximityDetectionRadiusRelativeValue = ProximityGrabRadiusScaleDefault;
|
||||
private float ProximityDetectionRadius => _proximityDetectionRadiusRelativeValue * PlayerSetup.Instance.GetPlaySpaceScale();
|
||||
|
||||
#endregion Proximity Grab
|
||||
|
||||
#region Constructor
|
||||
|
||||
public CVRPlayerRaycasterTransform(Transform rayOrigin, CVRHand hand) : base(rayOrigin) { _hand = hand; }
|
||||
|
||||
private readonly CVRHand _hand;
|
||||
|
||||
#endregion Constructor
|
||||
|
||||
#region Overrides
|
||||
|
||||
protected override Ray GetRayFromImpl() => new(_rayOrigin.position, _rayOrigin.forward);
|
||||
|
||||
protected override Ray GetProximityRayFromImpl()
|
||||
{
|
||||
Vector3 handPosition = _rayOrigin.position;
|
||||
Vector3 handRight = _rayOrigin.right;
|
||||
|
||||
// Offset the detection center forward, so we don't grab stuff behind our writs
|
||||
handPosition += _rayOrigin.forward * (ProximityDetectionRadius * 0.25f);
|
||||
|
||||
// Offset the detection center away from the palm, so we don't grab stuff behind our hand palm
|
||||
Vector3 palmOffset = handRight * (ProximityDetectionRadius * 0.75f);
|
||||
if (_hand == CVRHand.Left)
|
||||
handPosition += palmOffset;
|
||||
else
|
||||
handPosition -= palmOffset;
|
||||
|
||||
return new Ray(handPosition, _hand == CVRHand.Left ? handRight : -handRight);
|
||||
}
|
||||
|
||||
#endregion Overrides
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue