From b905fbbde3f45957fefe1ae033efb12412fc151f Mon Sep 17 00:00:00 2001 From: haitem Date: Sun, 30 Jan 2022 14:56:17 +0100 Subject: [PATCH] Fix move --- Assets/Scripts/PlayerController.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index e68670c..ddf346e 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -219,18 +219,18 @@ public class PlayerController : MonoBehaviour return; } - if (other.GetContact(0).normal == other.transform.forward - || other.GetContact(0).normal == -other.transform.forward - || other.GetContact(0).normal == -other.transform.right - || other.GetContact(0).normal == other.transform.right - || (other.GetContact(0).normal != -other.transform.up - && other.GetContact(0).normal != other.transform.up) + if (other.GetContact(other.contacts.Length - 1).normal == other.transform.forward + || other.GetContact(other.contacts.Length - 1).normal == -other.transform.forward + || other.GetContact(other.contacts.Length - 1).normal == -other.transform.right + || other.GetContact(other.contacts.Length - 1).normal == other.transform.right + || (other.GetContact(other.contacts.Length - 1).normal != -other.transform.up + && other.GetContact(other.contacts.Length - 1).normal != other.transform.up) ) { return; } this.downDirection = -transform.up; - saveDirection = -other.GetContact(0).normal; + saveDirection = -other.GetContact(other.contacts.Length - 1).normal; // TODO: Handle other PlatformTypes Physics.gravity = this.downDirection * 9.81f;