Более менее пашет
This commit is contained in:
1 parent
eed6b79efc
commit
33168b98d1
26 files changed
+443071
-19380
No files matched your search
@@ -6,6 +6,7 @@ public class CarFluidCap : MonoBehaviour, IInteractable
|
||||
private CarFluids ownerFluids;
|
||||
private CarFluids.FluidReservoir reservoir;
|
||||
private bool isOpen = false;
|
||||
private bool poseCaptured = false;
|
||||
|
||||
private Vector3 closedLocalPos;
|
||||
private Quaternion closedLocalRot;
|
||||
@@ -21,16 +22,22 @@ public class CarFluidCap : MonoBehaviour, IInteractable
|
||||
ownerFluids = owner;
|
||||
reservoir = res;
|
||||
|
||||
closedLocalPos = transform.localPosition;
|
||||
closedLocalRot = transform.localRotation;
|
||||
if (!poseCaptured)
|
||||
{
|
||||
poseCaptured = true;
|
||||
closedLocalPos = transform.localPosition;
|
||||
closedLocalRot = transform.localRotation;
|
||||
|
||||
// При открытии крышка приподнимается и сдвигается в сторону
|
||||
openLocalPos = closedLocalPos + new Vector3(0.08f, 0.09f, -0.04f);
|
||||
openLocalRot = closedLocalRot * Quaternion.Euler(0f, 180f, 35f);
|
||||
// При открытии крышка приподнимается и сдвигается в сторону
|
||||
openLocalPos = closedLocalPos + new Vector3(0.08f, 0.09f, -0.04f);
|
||||
openLocalRot = closedLocalRot * Quaternion.Euler(0f, 180f, 35f);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!poseCaptured) return;
|
||||
|
||||
Vector3 targetPos = isOpen ? openLocalPos : closedLocalPos;
|
||||
Quaternion targetRot = isOpen ? openLocalRot : closedLocalRot;
|
||||
|
||||
@@ -65,4 +72,4 @@ public class CarFluidCap : MonoBehaviour, IInteractable
|
||||
{
|
||||
isOpen = open;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user