Implemented basic wallrunning
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -5,6 +5,7 @@ TagManager:
|
||||
serializedVersion: 2
|
||||
tags:
|
||||
- Environment
|
||||
- Wall
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
||||
Reference in New Issue
Block a user