Edit player script
This commit is contained in:
		@@ -7,8 +7,8 @@ PhysicMaterial:
 | 
				
			|||||||
  m_PrefabInstance: {fileID: 0}
 | 
					  m_PrefabInstance: {fileID: 0}
 | 
				
			||||||
  m_PrefabAsset: {fileID: 0}
 | 
					  m_PrefabAsset: {fileID: 0}
 | 
				
			||||||
  m_Name: PlayerMaterial
 | 
					  m_Name: PlayerMaterial
 | 
				
			||||||
  dynamicFriction: 0
 | 
					  dynamicFriction: 1
 | 
				
			||||||
  staticFriction: 0
 | 
					  staticFriction: 1
 | 
				
			||||||
  bounciness: 0
 | 
					  bounciness: 0
 | 
				
			||||||
  frictionCombine: 0
 | 
					  frictionCombine: 0
 | 
				
			||||||
  bounceCombine: 0
 | 
					  bounceCombine: 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,14 +101,13 @@ public class PlayerController : MonoBehaviour
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        Physics.gravity = this.downDirection * 9.81f;
 | 
					 | 
				
			||||||
        // if (platform.type == PlatformManager.PlatformType.SpeedUp)
 | 
					        // if (platform.type == PlatformManager.PlatformType.SpeedUp)
 | 
				
			||||||
        // {
 | 
					        // {
 | 
				
			||||||
            angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.GetContact(0).normal));
 | 
					            angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.GetContact(0).normal));
 | 
				
			||||||
            transform.RotateAround(axis, angle);
 | 
					            transform.RotateAround(axis, angle);
 | 
				
			||||||
        // }
 | 
					        // }
 | 
				
			||||||
        // TODO: Handle other PlatformTypes
 | 
					        // 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;
 | 
					            Vector3 gDirection;
 | 
				
			||||||
            PlatformManager platform = other.gameObject.GetComponent<PlatformManager>();
 | 
					            PlatformManager platform = other.gameObject.GetComponent<PlatformManager>();
 | 
				
			||||||
            gDirection = -transform.up;
 | 
					            gDirection = -other.GetContact(0).normal;
 | 
				
			||||||
            if (platform == null){
 | 
					            if (platform == null){
 | 
				
			||||||
                // FIXME: remove
 | 
					                // FIXME: remove
 | 
				
			||||||
                this.downDirection = -transform.up;
 | 
					                this.downDirection = -transform.up;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user