Implemented basic wallrunning

This commit is contained in:
Gregory Campbell
2019-12-21 23:17:24 -05:00
parent a31a335424
commit f1db804155
3 changed files with 18 additions and 2 deletions
+2 -2
View File
@@ -167,7 +167,7 @@ GameObject:
- component: {fileID: 194035205}
m_Layer: 0
m_Name: Running Wall Left
m_TagString: Environment
m_TagString: Wall
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@@ -1391,7 +1391,7 @@ GameObject:
- component: {fileID: 858957127}
m_Layer: 0
m_Name: Running Wall Right
m_TagString: Environment
m_TagString: Wall
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
+15
View File
@@ -45,6 +45,16 @@ public class PlayerController : MonoBehaviour
maxSpeedStore = maxSpeed;
}
void OnControllerColliderHit(ControllerColliderHit hit)
{
if(hit.gameObject.tag == "Wall")
{
gravity = 0.5f;
}
}
void Update()
{
@@ -133,6 +143,11 @@ public class PlayerController : MonoBehaviour
jump++;
}
if (characterController.collisionFlags == CollisionFlags.None)
{
gravity = 5;
}
moveDirection.y += Physics.gravity.y * gravity * Time.deltaTime;
velocity = Vector3.ClampMagnitude(velocity, maxSpeed);
+1
View File
@@ -5,6 +5,7 @@ TagManager:
serializedVersion: 2
tags:
- Environment
- Wall
layers:
- Default
- TransparentFX