|
|
@@ -30,12 +30,13 @@ public class Foot : MonoBehaviour
|
|
|
{
|
|
|
if (trigGroundList.Count == 0)
|
|
|
{
|
|
|
- if (!haveGravity|| moveCharacter.platformY != 0)
|
|
|
+ if (!haveGravity|| moveCharacter.platformPosY != 0 || moveCharacter.platformRotZ!=0)
|
|
|
{
|
|
|
rb.useGravity = true;
|
|
|
haveGravity = true;
|
|
|
moveCharacter.velocityAddition = 0;
|
|
|
- moveCharacter.platformY = 0;
|
|
|
+ moveCharacter.platformPosY = 0;
|
|
|
+ moveCharacter.platformRotZ = 0;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -67,8 +68,17 @@ public class Foot : MonoBehaviour
|
|
|
{
|
|
|
rb.useGravity = false;
|
|
|
rb.velocity = new Vector3(rb.velocity.x, 0, rb.velocity.z);
|
|
|
- moveCharacter.platformY = platform.GetPosY(rb.transform.position);
|
|
|
- rb.transform.position = new Vector3(rb.transform.position.x, moveCharacter.platformY, rb.transform.position.z);
|
|
|
+ moveCharacter.platformPosY = platform.GetPosY(rb.transform.position);
|
|
|
+ float targetRotZ = platform.GetRotZ();
|
|
|
+ if (targetRotZ != moveCharacter.platformRotZ)
|
|
|
+ {
|
|
|
+ moveCharacter.platformRotZ = targetRotZ;
|
|
|
+ moveCharacter.RotLerpTime = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ rb.transform.position = new Vector3(rb.transform.position.x, moveCharacter.platformPosY, rb.transform.position.z);
|
|
|
+
|
|
|
+ //rb.transform.rotation = Quaternion.Euler(0, 0, moveCharacter.platformRotZ);
|
|
|
haveGravity = false;
|
|
|
|
|
|
}
|
|
|
@@ -79,7 +89,13 @@ public class Foot : MonoBehaviour
|
|
|
{
|
|
|
moveCharacter.velocityAddition = platform.rb.velocity.x;
|
|
|
}
|
|
|
- moveCharacter.platformY = platform.GetPosY(rb.transform.position);
|
|
|
+ moveCharacter.platformPosY = platform.GetPosY(rb.transform.position);
|
|
|
+ float targetRotZ = platform.GetRotZ();
|
|
|
+ if (targetRotZ != moveCharacter.platformRotZ)
|
|
|
+ {
|
|
|
+ moveCharacter.platformRotZ = targetRotZ;
|
|
|
+ moveCharacter.RotLerpTime = 0;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|