From 252decf25327cf1632e0034acc0de5dcaeb9c4f2 Mon Sep 17 00:00:00 2001 From: nexovec Date: Sat, 29 Jan 2022 12:41:50 +0100 Subject: [PATCH] work on gravity --- Assets/Scripts/PlayerController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 08681ac..fa24d59 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -149,25 +149,25 @@ public class PlayerController : MonoBehaviour } if (platform.type == PlatformManager.PlatformType.Pull) { - gDirection = -transform.up; + gDirection = -other.GetContact(0).normal; } 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)) { - gDirection = -transform.up; + gDirection = -other.GetContact(0).normal; } else if (platform.type == PlatformManager.PlatformType.SpeedUp) { 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) { rb.AddForce(other.transform.forward * platform.speed * 10 * Time.deltaTime, ForceMode.Impulse); - gDirection = -transform.up; + gDirection = -other.GetContact(0).normal; } this.downDirection = gDirection;