door script improve
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user