анус рвётся не по-детски
This commit is contained in:
1 parent
4b6909fe84
commit
d14f9c2a9f
2 files changed
+15
-13
No files matched your search
@@ -1,5 +1,4 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
|
||||||
|
|
||||||
namespace Code.Configs
|
namespace Code.Configs
|
||||||
{
|
{
|
||||||
|
|||||||
+15
-12
@@ -97,21 +97,25 @@ namespace Code.Gameplay.Character.Controller.Abilities
|
|||||||
public void HandleWallRun(ref Vector3 currentVelocity, CharacterInputs inputs, float deltaTime)
|
public void HandleWallRun(ref Vector3 currentVelocity, CharacterInputs inputs, float deltaTime)
|
||||||
{
|
{
|
||||||
if (!_isWallRunning) return;
|
if (!_isWallRunning) return;
|
||||||
|
if (!IsWallStillPresent()) { DetachFromWall(false); return; }
|
||||||
if (!IsWallStillPresent())
|
|
||||||
{
|
|
||||||
DetachFromWall(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 moveInputWorld = _inputHandler.MoveInputVector;
|
Vector3 moveInputWorld = _inputHandler.MoveInputVector;
|
||||||
|
Vector3 moveInWallPlane = Vector3.ProjectOnPlane(moveInputWorld, _wallNormal);
|
||||||
|
|
||||||
|
Vector3 wsMove = Vector3.Project(moveInWallPlane, _wallTangentRight);
|
||||||
|
|
||||||
Vector3 moveInWallPlane = Vector3.ProjectOnPlane(moveInputWorld, _wallNormal).normalized;
|
float ad = inputs.MoveAxisRight;
|
||||||
|
|
||||||
float inputMagnitude = moveInputWorld.magnitude;
|
float sideDot = Vector3.Dot(_wallNormal, _motor.CharacterRight);
|
||||||
moveInWallPlane *= inputMagnitude;
|
if (sideDot < 0)
|
||||||
|
ad = -ad;
|
||||||
|
|
||||||
Vector3 targetVelocity = moveInWallPlane * WallRunSpeed;
|
Vector3 adMove = _wallTangentUp * (-ad);
|
||||||
|
|
||||||
|
Vector3 finalMove = wsMove + adMove;
|
||||||
|
finalMove = finalMove.normalized * moveInputWorld.magnitude;
|
||||||
|
|
||||||
|
Vector3 targetVelocity = finalMove * WallRunSpeed;
|
||||||
|
|
||||||
currentVelocity = Vector3.Lerp(
|
currentVelocity = Vector3.Lerp(
|
||||||
currentVelocity,
|
currentVelocity,
|
||||||
@@ -119,8 +123,7 @@ namespace Code.Gameplay.Character.Controller.Abilities
|
|||||||
1f - Mathf.Exp(-WallRunAcceleration * deltaTime)
|
1f - Mathf.Exp(-WallRunAcceleration * deltaTime)
|
||||||
);
|
);
|
||||||
|
|
||||||
Vector3 gravity = Physics.gravity * WallRunGravityScale;
|
currentVelocity += Physics.gravity * WallRunGravityScale * deltaTime;
|
||||||
currentVelocity += gravity * deltaTime;
|
|
||||||
|
|
||||||
float distanceToWall = Vector3.Dot(_motor.TransientPosition - _wallContactPoint, _wallNormal);
|
float distanceToWall = Vector3.Dot(_motor.TransientPosition - _wallContactPoint, _wallNormal);
|
||||||
if (Mathf.Abs(distanceToWall) > 0.8f)
|
if (Mathf.Abs(distanceToWall) > 0.8f)
|
||||||
|
|||||||
Reference in new issue
Block a user