From 435fea4669a8e6cb35384a929355b202e9ac2a29 Mon Sep 17 00:00:00 2001 From: haitem Date: Sat, 29 Jan 2022 12:50:26 +0100 Subject: [PATCH] Edit player script --- Assets/Materials/PlayerMaterial.physicMaterial | 4 ++-- Assets/Scripts/PlayerController.cs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Assets/Materials/PlayerMaterial.physicMaterial b/Assets/Materials/PlayerMaterial.physicMaterial index 7e88d8b..85fae2f 100644 --- a/Assets/Materials/PlayerMaterial.physicMaterial +++ b/Assets/Materials/PlayerMaterial.physicMaterial @@ -7,8 +7,8 @@ PhysicMaterial: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: PlayerMaterial - dynamicFriction: 0 - staticFriction: 0 + dynamicFriction: 1 + staticFriction: 1 bounciness: 0 frictionCombine: 0 bounceCombine: 0 diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index fa24d59..bb22bd9 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -101,14 +101,13 @@ public class PlayerController : MonoBehaviour { return; } - Physics.gravity = this.downDirection * 9.81f; // if (platform.type == PlatformManager.PlatformType.SpeedUp) // { angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.GetContact(0).normal)); transform.RotateAround(axis, angle); // } // TODO: Handle other PlatformTypes - Physics.gravity = this.downDirection * 9.81f; + Physics.gravity = -other.GetContact(0).normal * 9.81f; } @@ -141,7 +140,7 @@ public class PlayerController : MonoBehaviour Vector3 gDirection; PlatformManager platform = other.gameObject.GetComponent(); - gDirection = -transform.up; + gDirection = -other.GetContact(0).normal; if (platform == null){ // FIXME: remove this.downDirection = -transform.up;