door script improve

This commit is contained in:
GodGodGod20081
2026-06-18 13:53:07 +02:00
parent ef3f1c8615
commit ce681510ea
-2
View File
@@ -20,7 +20,6 @@ public class Door_Rotate : MonoBehaviour
currentRotation = transform.localEulerAngles.y; currentRotation = transform.localEulerAngles.y;
targetRotation = currentRotation; targetRotation = currentRotation;
// Calculate pivot point from rotation offset
pivotPoint = transform.position + rotationOffset; pivotPoint = transform.position + rotationOffset;
} }
@@ -44,7 +43,6 @@ public class Door_Rotate : MonoBehaviour
{ {
currentRotation = Mathf.Lerp(currentRotation, targetRotation, Time.deltaTime * rotationSpeed); currentRotation = Mathf.Lerp(currentRotation, targetRotation, Time.deltaTime * rotationSpeed);
// Rotate around the pivot point
transform.RotateAround(pivotPoint, Vector3.up, (currentRotation - transform.localEulerAngles.y)); transform.RotateAround(pivotPoint, Vector3.up, (currentRotation - transform.localEulerAngles.y));
transform.localEulerAngles = new Vector3( transform.localEulerAngles = new Vector3(
transform.localEulerAngles.x, transform.localEulerAngles.x,