Files
FueraDeEscala/Assets/Game Kit Controller/Scripts/Player/Animator IK/handsOnSurfaceIKSystem.cs

626 lines
21 KiB
C#
Raw Normal View History

using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public class handsOnSurfaceIKSystem : OnAnimatorIKComponent
{
2026-03-29 23:03:14 -07:00
[Header ("Main Settings")]
[Space]
2026-03-29 23:03:14 -07:00
public bool adjustHandsToSurfacesEnabled = true;
2026-03-29 23:03:14 -07:00
public LayerMask layerToAdjustHandsToSurfaces;
2026-03-29 23:03:14 -07:00
public float movementSpeedLerpSpeed = 2;
2026-03-29 23:03:14 -07:00
public float waitTimeAfterGroundToCheckSurface = 1.5f;
public float waitTimeAfterCrouchToCheckSurface = 1.5f;
2026-03-29 23:03:14 -07:00
public float weightLerpSpeed = 6;
2026-03-29 23:03:14 -07:00
public float maxHandsDistance = 3;
2026-03-29 23:03:14 -07:00
public float minMovingInputToUseWalkSpeed = 0.5f;
public float minIKWeightToUseWalkSpeed = 0.4f;
2026-03-29 23:03:14 -07:00
public bool pauseHandsOnSurfaceIfCloseCombatActive;
2026-03-29 23:03:14 -07:00
[Space]
[Header ("Hands Info List Settings")]
[Space]
2026-03-29 23:03:14 -07:00
public List<handsToSurfaceInfo> handsToSurfaceInfoList = new List<handsToSurfaceInfo> ();
2026-03-29 23:03:14 -07:00
[Space]
[Header ("Debug")]
[Space]
2026-03-29 23:03:14 -07:00
public bool usingHands;
public bool adjustHandsPaused;
2026-03-29 23:03:14 -07:00
public bool smoothBusyDisableActive;
2026-03-29 23:03:14 -07:00
public bool handsCheckPausedWithDelayActive;
2026-03-29 23:03:14 -07:00
public bool isBusy;
2026-03-29 23:03:14 -07:00
[Space]
[Header ("Gizmo Settings")]
[Space]
2026-03-29 23:03:14 -07:00
public bool showGizmo;
public Color gizmoColor = Color.white;
public float gizmoRadius;
2026-03-29 23:03:14 -07:00
[Space]
[Header ("Component Elements")]
[Space]
2026-03-29 23:03:14 -07:00
public Animator animator;
public IKSystem IKManager;
public playerController playerControllerManager;
public Transform playerTransform;
2026-03-29 23:03:14 -07:00
handsToSurfaceInfo currentHandInfo;
Vector3 rayDirection;
2026-03-29 23:03:14 -07:00
RaycastHit hit;
float movementSpeed;
float currentMovementSpeed;
2026-03-29 23:03:14 -07:00
bool isThirdPersonView;
2026-03-29 23:03:14 -07:00
bool onGround;
2026-03-29 23:03:14 -07:00
bool movingOnPlatformActive;
2026-03-29 23:03:14 -07:00
bool dead;
2026-03-29 23:03:14 -07:00
bool groundChecked;
float lastTimeOnGround;
2026-03-29 23:03:14 -07:00
bool crouchingChecked;
float lastTimeCrouch;
2026-03-29 23:03:14 -07:00
Vector3 currentPositionCenter;
2026-03-29 23:03:14 -07:00
float currentRotationSpeed;
2026-03-29 23:03:14 -07:00
float originalWeightLerpSpeed;
2026-03-29 23:03:14 -07:00
bool crouching;
2026-03-29 23:03:14 -07:00
Transform rightHandTransform;
Transform leftHandTransform;
2026-03-29 23:03:14 -07:00
bool isRightHand;
2026-03-29 23:03:14 -07:00
multipleRayInfo currentMultipleRayInfo;
2026-03-29 23:03:14 -07:00
Vector3 currentTransformUp;
2026-03-29 23:03:14 -07:00
Vector3 currentTransformForward;
2026-03-29 23:03:14 -07:00
Vector3 vector3Zero = Vector3.zero;
2026-03-29 23:03:14 -07:00
Quaternion targetRotation;
2026-03-29 23:03:14 -07:00
Vector3 currentHandPosition;
2026-03-29 23:03:14 -07:00
float currentWeightToApply;
2026-03-29 23:03:14 -07:00
AvatarIKGoal currentIKGoal;
2026-03-29 23:03:14 -07:00
int handsToSurfaceInfoListCount;
2026-03-29 23:03:14 -07:00
float minIKValue = 0.001f;
2026-03-29 23:03:14 -07:00
float currentDeltaTime;
2026-03-29 23:03:14 -07:00
Coroutine delayToResumeStateCoroutine;
2026-03-29 23:03:14 -07:00
void Start ()
{
originalWeightLerpSpeed = weightLerpSpeed;
2026-03-29 23:03:14 -07:00
rightHandTransform = animator.GetBoneTransform (HumanBodyBones.RightHand);
2026-03-29 23:03:14 -07:00
leftHandTransform = animator.GetBoneTransform (HumanBodyBones.LeftHand);
2026-03-29 23:03:14 -07:00
handsToSurfaceInfoListCount = handsToSurfaceInfoList.Count;
}
2026-03-29 23:03:14 -07:00
void FixedUpdate ()
{
if (!adjustHandsToSurfacesEnabled) {
return;
}
2026-03-29 23:03:14 -07:00
isThirdPersonView = !playerControllerManager.isPlayerOnFirstPerson ();
2026-03-29 23:03:14 -07:00
usingHands = IKManager.getUsingHands ();
2026-03-29 23:03:14 -07:00
onGround = playerControllerManager.isPlayerOnGround ();
2026-03-29 23:03:14 -07:00
movingOnPlatformActive = playerControllerManager.isMovingOnPlatformActive ();
2026-03-29 23:03:14 -07:00
isBusy = playerIsBusy ();
2026-03-29 23:03:14 -07:00
crouching = playerControllerManager.isCrouching ();
2026-03-29 23:03:14 -07:00
dead = playerControllerManager.isPlayerDead ();
2026-03-29 23:03:14 -07:00
if (groundChecked != onGround) {
groundChecked = onGround;
2026-03-29 23:03:14 -07:00
if (onGround) {
lastTimeOnGround = Time.time;
}
}
2026-03-29 23:03:14 -07:00
if (crouchingChecked != crouching) {
crouchingChecked = crouching;
2026-03-29 23:03:14 -07:00
if (!crouching) {
lastTimeCrouch = Time.time;
}
}
2026-03-29 23:03:14 -07:00
if (adjustHandsToSurfacesEnabled) {
if (!isBusy || smoothBusyDisableActive) {
2026-03-29 23:03:14 -07:00
currentTransformUp = playerTransform.up;
currentTransformForward = playerTransform.forward;
2026-03-29 23:03:14 -07:00
for (int j = 0; j < handsToSurfaceInfoListCount; j++) {
2026-03-29 23:03:14 -07:00
currentHandInfo = handsToSurfaceInfoList [j];
2026-03-29 23:03:14 -07:00
currentHandInfo.surfaceFound = false;
currentHandInfo.multipleRaycastHitNormal = vector3Zero;
currentHandInfo.multipleRaycastHitPoint = vector3Zero;
currentHandInfo.numberOfSurfacesFound = 0;
currentHandInfo.multipleRaycastDirection = vector3Zero;
2026-03-29 23:03:14 -07:00
for (int k = 0; k < currentHandInfo.raycastTransformList.Count; k++) {
currentMultipleRayInfo = currentHandInfo.raycastTransformList [k];
2026-03-29 23:03:14 -07:00
rayDirection = currentMultipleRayInfo.raycastTransform.forward;
2026-03-29 23:03:14 -07:00
if (currentMultipleRayInfo.raycastEnabled &&
Physics.Raycast (currentMultipleRayInfo.raycastTransform.position, rayDirection, out hit,
currentMultipleRayInfo.rayCastDistance, layerToAdjustHandsToSurfaces)) {
2026-03-29 23:03:14 -07:00
currentMultipleRayInfo.hitPoint = hit.point;
currentMultipleRayInfo.hitNormal = hit.normal;
currentHandInfo.surfaceFound = true;
currentHandInfo.multipleRaycastHitNormal += hit.normal;
currentHandInfo.multipleRaycastHitPoint += hit.point;
2026-03-29 23:03:14 -07:00
currentHandInfo.numberOfSurfacesFound++;
currentHandInfo.multipleRaycastDirection += rayDirection;
2026-03-29 23:03:14 -07:00
if (showGizmo) {
Debug.DrawRay (currentMultipleRayInfo.raycastTransform.position, hit.distance * rayDirection, Color.green);
}
} else {
if (showGizmo) {
Debug.DrawRay (currentMultipleRayInfo.raycastTransform.position,
currentMultipleRayInfo.rayCastDistance * rayDirection, Color.red);
}
}
}
2026-03-29 23:03:14 -07:00
if (smoothBusyDisableActive) {
currentHandInfo.surfaceFound = false;
2026-03-29 23:03:14 -07:00
if (currentWeightInBothHandsEqualTo (0)) {
smoothBusyDisableActive = false;
}
}
2026-03-29 23:03:14 -07:00
if (currentHandInfo.surfaceFound) {
currentHandInfo.handPosition =
(currentHandInfo.multipleRaycastHitPoint / currentHandInfo.numberOfSurfacesFound) +
(currentHandInfo.handSurfaceOffset * currentHandInfo.multipleRaycastDirection / currentHandInfo.numberOfSurfacesFound);
2026-03-29 23:03:14 -07:00
targetRotation = Quaternion.LookRotation (currentHandInfo.multipleRaycastDirection / currentHandInfo.numberOfSurfacesFound);
2026-03-29 23:03:14 -07:00
currentHandInfo.handRotation =
Quaternion.FromToRotation (currentTransformUp, currentHandInfo.multipleRaycastHitNormal / currentHandInfo.numberOfSurfacesFound) * targetRotation;
2026-03-29 23:03:14 -07:00
currentHandInfo.elbowPosition =
((currentHandInfo.multipleRaycastHitPoint / currentHandInfo.numberOfSurfacesFound) + currentHandInfo.raycastTransform.position) / 2 - currentTransformUp * 0.1f;
2026-03-29 23:03:14 -07:00
currentHandInfo.handWeight = 1;
2026-03-29 23:03:14 -07:00
if (currentHandInfo.useMinDistance) {
currentHandInfo.currentDistance = GKC_Utils.distance (currentHandInfo.raycastTransform.position, currentHandInfo.handPosition);
2026-03-29 23:03:14 -07:00
if (currentHandInfo.currentDistance < currentHandInfo.minDistance) {
currentHandInfo.surfaceFound = false;
}
}
}
2026-03-29 23:03:14 -07:00
if (handsCheckPausedWithDelayActive ||
!currentHandInfo.surfaceFound ||
movingOnPlatformActive ||
!onGround ||
Time.time < waitTimeAfterGroundToCheckSurface + lastTimeOnGround ||
crouching ||
Time.time < waitTimeAfterCrouchToCheckSurface + lastTimeCrouch ||
dead) {
2026-03-29 23:03:14 -07:00
currentHandInfo.handPosition = currentHandInfo.noSurfaceHandPosition.position;
currentHandInfo.handRotation = Quaternion.LookRotation (currentTransformForward);
2026-03-29 23:03:14 -07:00
currentHandInfo.elbowPosition = currentHandInfo.noSurfaceElbowPosition.position;
2026-03-29 23:03:14 -07:00
currentHandInfo.handWeight = 0;
}
2026-03-29 23:03:14 -07:00
if (playerControllerManager.isPlayerMoving (minMovingInputToUseWalkSpeed) &&
currentHandInfo.surfaceFound && currentHandInfo.currentHandWeight > minIKWeightToUseWalkSpeed) {
movementSpeed = currentHandInfo.walkingMovementSpeed;
} else {
movementSpeed = currentHandInfo.movementSpeed;
}
2026-03-29 23:03:14 -07:00
currentDeltaTime = Time.deltaTime;
2026-03-29 23:03:14 -07:00
currentMovementSpeed = Mathf.Lerp (currentMovementSpeed, movementSpeed, currentDeltaTime * movementSpeedLerpSpeed);
2026-03-29 23:03:14 -07:00
currentHandInfo.currentHandPosition = Vector3.Lerp (currentHandInfo.currentHandPosition, currentHandInfo.handPosition, currentDeltaTime * currentMovementSpeed);
2026-03-29 23:03:14 -07:00
currentRotationSpeed = currentDeltaTime * currentHandInfo.rotationSpeed;
2026-03-29 23:03:14 -07:00
if (currentRotationSpeed > 0) {
currentHandInfo.currentHandRotation = Quaternion.Lerp (currentHandInfo.currentHandRotation, currentHandInfo.handRotation, currentRotationSpeed);
}
2026-03-29 23:03:14 -07:00
currentHandInfo.currentElbowPosition = Vector3.Lerp (currentHandInfo.currentElbowPosition, currentHandInfo.elbowPosition, currentDeltaTime * currentMovementSpeed);
2026-03-29 23:03:14 -07:00
currentHandInfo.currentHandWeight = Mathf.Lerp (currentHandInfo.currentHandWeight, currentHandInfo.handWeight, currentDeltaTime * weightLerpSpeed);
2026-03-29 23:03:14 -07:00
if (currentHandInfo.currentHandWeight < 0.01f) {
currentHandInfo.handPosition = currentHandInfo.noSurfaceHandPosition.position;
currentHandInfo.handRotation = Quaternion.LookRotation (currentTransformForward);
2026-03-29 23:03:14 -07:00
currentHandInfo.elbowPosition = currentHandInfo.noSurfaceElbowPosition.position;
2026-03-29 23:03:14 -07:00
currentHandInfo.currentHandPosition = currentHandInfo.handPosition;
2026-03-29 23:03:14 -07:00
currentHandInfo.currentHandRotation = currentHandInfo.handRotation;
2026-03-29 23:03:14 -07:00
currentHandInfo.currentElbowPosition = currentHandInfo.elbowPosition;
}
}
} else {
2026-03-29 23:03:14 -07:00
currentTransformForward = playerTransform.forward;
2026-03-29 23:03:14 -07:00
for (int j = 0; j < handsToSurfaceInfoListCount; j++) {
2026-03-29 23:03:14 -07:00
currentHandInfo = handsToSurfaceInfoList [j];
2026-03-29 23:03:14 -07:00
currentHandInfo.surfaceFound = false;
2026-03-29 23:03:14 -07:00
currentHandInfo.handWeight = 0;
2026-03-29 23:03:14 -07:00
currentHandInfo.currentHandWeight = 0;
currentHandInfo.handPosition = currentHandInfo.noSurfaceHandPosition.position;
currentHandInfo.handRotation = Quaternion.LookRotation (currentTransformForward);
2026-03-29 23:03:14 -07:00
currentHandInfo.elbowPosition = currentHandInfo.noSurfaceElbowPosition.position;
2026-03-29 23:03:14 -07:00
currentHandInfo.currentHandPosition = currentHandInfo.handPosition;
2026-03-29 23:03:14 -07:00
currentHandInfo.currentHandRotation = currentHandInfo.handRotation;
2026-03-29 23:03:14 -07:00
currentHandInfo.currentElbowPosition = currentHandInfo.elbowPosition;
}
2026-03-29 23:03:14 -07:00
}
}
}
2026-03-29 23:03:14 -07:00
public bool currentWeightInBothHandsEqualTo (float weightValue)
{
int numberOfHands = 0;
2026-03-29 23:03:14 -07:00
for (int j = 0; j < handsToSurfaceInfoListCount; j++) {
if (handsToSurfaceInfoList [j].currentHandWeight == weightValue) {
numberOfHands++;
}
}
2026-03-29 23:03:14 -07:00
if (numberOfHands == 2) {
return true;
}
2026-03-29 23:03:14 -07:00
return false;
}
2026-03-29 23:03:14 -07:00
public override void updateOnAnimatorIKState ()
{
if (adjustHandsToSurfacesEnabled) {
2026-03-29 23:03:14 -07:00
if (!isBusy || smoothBusyDisableActive) {
2026-03-29 23:03:14 -07:00
currentPositionCenter = playerTransform.position + playerTransform.up;
2026-03-29 23:03:14 -07:00
for (int j = 0; j < handsToSurfaceInfoListCount; j++) {
2026-03-29 23:03:14 -07:00
currentHandInfo = handsToSurfaceInfoList [j];
2026-03-29 23:03:14 -07:00
isRightHand = currentHandInfo.isRightHand;
2026-03-29 23:03:14 -07:00
currentHandPosition = currentHandInfo.currentHandPosition;
2026-03-29 23:03:14 -07:00
if (float.IsNaN (currentHandPosition.x)) {
if (isRightHand) {
currentHandPosition.x = rightHandTransform.position.x;
} else {
currentHandPosition.x = leftHandTransform.position.x;
}
}
2026-03-29 23:03:14 -07:00
if (float.IsNaN (currentHandPosition.y)) {
if (isRightHand) {
currentHandPosition.y = rightHandTransform.position.y;
} else {
currentHandPosition.y = leftHandTransform.position.y;
}
}
2026-03-29 23:03:14 -07:00
if (float.IsNaN (currentHandPosition.z)) {
if (isRightHand) {
currentHandPosition.z = rightHandTransform.position.z;
} else {
currentHandPosition.z = leftHandTransform.position.z;
}
}
2026-03-29 23:03:14 -07:00
currentHandPosition.x =
Mathf.Clamp (currentHandPosition.x, currentPositionCenter.x - maxHandsDistance, currentPositionCenter.x + maxHandsDistance);
currentHandPosition.y =
Mathf.Clamp (currentHandPosition.y, currentPositionCenter.y - maxHandsDistance, currentPositionCenter.y + maxHandsDistance);
currentHandPosition.z =
Mathf.Clamp (currentHandPosition.z, currentPositionCenter.z - maxHandsDistance, currentPositionCenter.z + maxHandsDistance);
2026-03-29 23:03:14 -07:00
currentHandInfo.currentHandPosition = currentHandPosition;
2026-03-29 23:03:14 -07:00
currentWeightToApply = currentHandInfo.currentHandWeight;
2026-03-29 23:03:14 -07:00
if (currentWeightToApply > minIKValue) {
2026-03-29 23:03:14 -07:00
currentIKGoal = currentHandInfo.IKGoal;
2026-03-29 23:03:14 -07:00
animator.SetIKRotationWeight (currentIKGoal, currentWeightToApply);
animator.SetIKPositionWeight (currentIKGoal, currentWeightToApply);
2026-03-29 23:03:14 -07:00
animator.SetIKPosition (currentIKGoal, currentHandInfo.currentHandPosition);
animator.SetIKRotation (currentIKGoal, currentHandInfo.currentHandRotation);
2026-03-29 23:03:14 -07:00
if (currentHandInfo.useElbowIK) {
animator.SetIKHintPositionWeight (currentHandInfo.IKHint, currentWeightToApply);
animator.SetIKHintPosition (currentHandInfo.IKHint, currentHandInfo.currentElbowPosition);
}
}
}
}
}
}
2026-03-29 23:03:14 -07:00
public bool playerIsBusy ()
{
return
2026-03-29 23:03:14 -07:00
usingHands ||
!isThirdPersonView ||
playerControllerManager.isPlayerOnFFOrZeroGravityModeOn () ||
(playerControllerManager.isUsingCloseCombatActive () && pauseHandsOnSurfaceIfCloseCombatActive) ||
playerControllerManager.iscloseCombatAttackInProcess () ||
playerControllerManager.isActionActive () ||
adjustHandsPaused ||
playerControllerManager.isUsingJetpack () ||
playerControllerManager.isFlyingActive () ||
playerControllerManager.isSwimModeActive () ||
playerControllerManager.isCarryingPhysicalObject ();
}
2026-03-29 23:03:14 -07:00
public void setWeightLerpSpeedValue (float newValue)
{
weightLerpSpeed = newValue;
}
2026-03-29 23:03:14 -07:00
public void setOriginalWeightLerpSpeed ()
{
setWeightLerpSpeedValue (originalWeightLerpSpeed);
}
2026-03-29 23:03:14 -07:00
public void setAdjustHandsPausedState (bool state)
{
adjustHandsPaused = state;
}
2026-03-29 23:03:14 -07:00
public void setSmoothBusyDisableActiveState (bool state)
{
smoothBusyDisableActive = state;
}
public void setAdjustHandsToSurfacesEnabledState (bool state)
{
adjustHandsToSurfacesEnabled = state;
}
public void enableHandsCheckPausedWithDelayActive (float duration)
{
stopUpdateDelayToResumeStateCoroutine ();
delayToResumeStateCoroutine = StartCoroutine (updateDelayToResumeStateCoroutine (duration));
}
public void stopUpdateDelayToResumeStateCoroutine ()
{
if (delayToResumeStateCoroutine != null) {
StopCoroutine (delayToResumeStateCoroutine);
}
handsCheckPausedWithDelayActive = false;
}
IEnumerator updateDelayToResumeStateCoroutine (float duration)
{
handsCheckPausedWithDelayActive = true;
WaitForSeconds delay = new WaitForSeconds (duration);
2026-03-29 23:03:14 -07:00
yield return delay;
2026-03-29 23:03:14 -07:00
handsCheckPausedWithDelayActive = false;
}
2026-03-29 23:03:14 -07:00
//EDITOR FUNCTIONS
public void setAdjustHandsToSurfacesEnabledStateFromEditor (bool state)
{
setAdjustHandsToSurfacesEnabledState (state);
2026-03-29 23:03:14 -07:00
updateComponent ();
}
void updateComponent ()
{
GKC_Utils.updateComponent (this);
}
#if UNITY_EDITOR
void OnDrawGizmos ()
2026-03-29 23:03:14 -07:00
{
if (!showGizmo) {
return;
}
2026-03-29 23:03:14 -07:00
if (GKC_Utils.isCurrentSelectionActiveGameObject (gameObject)) {
DrawGizmos ();
}
}
2026-03-29 23:03:14 -07:00
void OnDrawGizmosSelected ()
{
DrawGizmos ();
}
2026-03-29 23:03:14 -07:00
void DrawGizmos ()
{
if (showGizmo) {
for (int j = 0; j < handsToSurfaceInfoList.Count; j++) {
Gizmos.color = Color.green;
Gizmos.DrawSphere (handsToSurfaceInfoList [j].handPosition, gizmoRadius);
2026-03-29 23:03:14 -07:00
Gizmos.color = Color.yellow;
Gizmos.DrawSphere (handsToSurfaceInfoList [j].elbowPosition, gizmoRadius);
2026-03-29 23:03:14 -07:00
Gizmos.color = gizmoColor;
Gizmos.DrawSphere (handsToSurfaceInfoList [j].currentHandPosition, gizmoRadius);
Gizmos.DrawSphere (handsToSurfaceInfoList [j].currentElbowPosition, gizmoRadius);
}
}
}
#endif
2026-03-29 23:03:14 -07:00
[System.Serializable]
public class handsToSurfaceInfo
{
[Header ("Main Settings")]
[Space]
2026-03-29 23:03:14 -07:00
public string Name;
public Transform raycastTransform;
2026-03-29 23:03:14 -07:00
public bool useMultipleRaycast;
public List<multipleRayInfo> raycastTransformList = new List<multipleRayInfo> ();
2026-03-29 23:03:14 -07:00
[Space]
[Header ("Other Settings")]
[Space]
2026-03-29 23:03:14 -07:00
public bool isRightHand;
public AvatarIKGoal IKGoal;
public float handSurfaceOffset;
public float rayCastDistance;
2026-03-29 23:03:14 -07:00
[Space]
2026-03-29 23:03:14 -07:00
public float movementSpeed;
public float rotationSpeed;
2026-03-29 23:03:14 -07:00
public float walkingMovementSpeed;
2026-03-29 23:03:14 -07:00
public bool useMinDistance;
public float minDistance;
2026-03-29 23:03:14 -07:00
[Space]
[Header ("Elbow Settings")]
[Space]
2026-03-29 23:03:14 -07:00
public bool useElbowIK = true;
2026-03-29 23:03:14 -07:00
public AvatarIKHint IKHint;
2026-03-29 23:03:14 -07:00
[HideInInspector] public Vector3 elbowPosition;
[HideInInspector] public Vector3 currentElbowPosition;
2026-03-29 23:03:14 -07:00
[HideInInspector] public bool surfaceFound;
2026-03-29 23:03:14 -07:00
[HideInInspector] public float currentDistance;
2026-03-29 23:03:14 -07:00
[HideInInspector] public Vector3 multipleRaycastDirection;
[HideInInspector] public int numberOfSurfacesFound;
[HideInInspector] public Vector3 multipleRaycastHitNormal;
[HideInInspector] public Vector3 multipleRaycastHitPoint;
[HideInInspector] public float handWeight;
[HideInInspector] public Vector3 handPosition;
[HideInInspector] public Quaternion handRotation;
[HideInInspector] public Vector3 currentHandPosition;
[HideInInspector] public Quaternion currentHandRotation;
[Space]
[Header ("Components")]
[Space]
public Transform noSurfaceHandPosition;
public Transform noSurfaceElbowPosition;
[Space]
[Header ("Debug")]
[Space]
public float currentHandWeight;
}
[System.Serializable]
public class multipleRayInfo
{
public Transform raycastTransform;
public float rayCastDistance;
public bool raycastEnabled = true;
[Space]
public bool surfaceFound;
[HideInInspector] public Vector3 hitPoint;
[HideInInspector] public Vector3 hitNormal;
}
}