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

@@ -0,0 +1,49 @@
using GogoGaga.OptimizedRopesAndCables;
using System.Collections;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit.Interactables;
public class MaterialRopeDetachAction : MonoBehaviour
{
[SerializeField]
Vector3 InitialCords;
[SerializeField]
Quaternion InitialRotation;
bool resetAsked = false;
XRGrabInteractable grabComponent;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
grabComponent = gameObject.GetComponent<XRGrabInteractable>();
InitialCords = transform.localPosition;
InitialRotation = gameObject.transform.rotation;
StartCoroutine(ResetPosTimed());
//Rope = gameObject.GetComponentInChildren<Rope>();
}
IEnumerator ResetPosTimed()
{
yield return new WaitForFixedUpdate();
if (!grabComponent.isSelected)
{
transform.localPosition = InitialCords;
transform.rotation = InitialRotation;
}
StartCoroutine(ResetPosTimed());
}
public void ResetPos()
{
transform.localPosition = InitialCords;
transform.rotation = InitialRotation;
//Rope.RecalculateRope();
// gameObject.GetComponent<XRGrabInteractable>().interactionManager.
//Invoke("InvokedReset", 0.1f);
//resetAsked = true;
}
}