Implemented basic wallrunning
This commit is contained in:
@@ -167,7 +167,7 @@ GameObject:
|
|||||||
- component: {fileID: 194035205}
|
- component: {fileID: 194035205}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Running Wall Left
|
m_Name: Running Wall Left
|
||||||
m_TagString: Environment
|
m_TagString: Wall
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
@@ -1391,7 +1391,7 @@ GameObject:
|
|||||||
- component: {fileID: 858957127}
|
- component: {fileID: 858957127}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Running Wall Right
|
m_Name: Running Wall Right
|
||||||
m_TagString: Environment
|
m_TagString: Wall
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ public class PlayerController : MonoBehaviour
|
|||||||
maxSpeedStore = maxSpeed;
|
maxSpeedStore = maxSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnControllerColliderHit(ControllerColliderHit hit)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(hit.gameObject.tag == "Wall")
|
||||||
|
{
|
||||||
|
gravity = 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -133,6 +143,11 @@ public class PlayerController : MonoBehaviour
|
|||||||
jump++;
|
jump++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (characterController.collisionFlags == CollisionFlags.None)
|
||||||
|
{
|
||||||
|
gravity = 5;
|
||||||
|
}
|
||||||
|
|
||||||
moveDirection.y += Physics.gravity.y * gravity * Time.deltaTime;
|
moveDirection.y += Physics.gravity.y * gravity * Time.deltaTime;
|
||||||
|
|
||||||
velocity = Vector3.ClampMagnitude(velocity, maxSpeed);
|
velocity = Vector3.ClampMagnitude(velocity, maxSpeed);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ TagManager:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
tags:
|
tags:
|
||||||
- Environment
|
- Environment
|
||||||
|
- Wall
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|||||||
Reference in New Issue
Block a user