Reworked Socket + EndPos reset

This commit is contained in:
FreshMix committed 2025-12-19 14:00:22 +03:00
1 parent 085d330a87
commit 430f676e49
151 files changed
+18194 -18446

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
using System.Collections;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
using UnityEngine.XR.Interaction.Toolkit.Interactables;
public class BabinaScript : MonoBehaviour
{
[SerializeField]
MeshRenderer RopeRenderer;
[SerializeField]
MeshRenderer WireCapRenderer;
[SerializeField]
GameObject EndPos;
InteractionLayerMask InitInteractionLayers;
bool SyncingWithSocket = false;
Transform SocketAttach;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
InitInteractionLayers = gameObject.GetComponent<XRGrabInteractable>().interactionLayers;
}
IEnumerator SnapToSocketReset()
{
while (gameObject.transform.position != SocketAttach.position)
{
yield return null;
}
EndPos.GetComponent<XRGrabInteractable>().interactionLayers = InitInteractionLayers;
EndPos.GetComponent<Collider>().enabled = true;
//EndPos.GetComponent<MaterialRopeDetachAction>().ResetPos();
RopeRenderer.enabled = true;
WireCapRenderer.enabled = true;
}
public void SwitchToRope(InteractionLayerMask SocketMask, Transform v_SocketAttach)
{
gameObject.GetComponent<XRGrabInteractable>().interactionLayers = SocketMask;
SocketAttach = v_SocketAttach;
StartCoroutine(SnapToSocketReset());
}
}