work on gravity

This commit is contained in:
nexovec 2022-01-29 12:41:50 +01:00
parent 97680bbe87
commit 252decf253

View File

@ -149,25 +149,25 @@ public class PlayerController : MonoBehaviour
} }
if (platform.type == PlatformManager.PlatformType.Pull) if (platform.type == PlatformManager.PlatformType.Pull)
{ {
gDirection = -transform.up; gDirection = -other.GetContact(0).normal;
} }
else if (platform.type == PlatformManager.PlatformType.Push) else if (platform.type == PlatformManager.PlatformType.Push)
{ {
gDirection = transform.up; gDirection = -other.GetContact(0).normal;
} }
else if ((platform.type == PlatformManager.PlatformType.RotateY || platform.type == PlatformManager.PlatformType.RotateZ)) else if ((platform.type == PlatformManager.PlatformType.RotateY || platform.type == PlatformManager.PlatformType.RotateZ))
{ {
gDirection = -transform.up; gDirection = -other.GetContact(0).normal;
} }
else if (platform.type == PlatformManager.PlatformType.SpeedUp) else if (platform.type == PlatformManager.PlatformType.SpeedUp)
{ {
rb.AddForce(other.transform.forward * platform.speed * Time.deltaTime, ForceMode.Impulse); rb.AddForce(other.transform.forward * platform.speed * Time.deltaTime, ForceMode.Impulse);
gDirection = -transform.up; gDirection = -other.GetContact(0).normal;
} }
else if (platform.type == PlatformManager.PlatformType.SpeedDown) else if (platform.type == PlatformManager.PlatformType.SpeedDown)
{ {
rb.AddForce(other.transform.forward * platform.speed * 10 * Time.deltaTime, ForceMode.Impulse); rb.AddForce(other.transform.forward * platform.speed * 10 * Time.deltaTime, ForceMode.Impulse);
gDirection = -transform.up; gDirection = -other.GetContact(0).normal;
} }
this.downDirection = gDirection; this.downDirection = gDirection;