Something fixed

This commit is contained in:
ThomasCharester committed 2026-11-10 00:28:25 +03:00
1 parent f40a10912c
commit 7d236d14cd
72 files changed
+270482 -11409

No files matched your search

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Alchemy.Inspector;
using Code.OfficeGame.BattleMode.Actions;
using KinematicCharacterController;
using LitMotion;
using LitMotion.Extensions;
@@ -56,12 +57,11 @@ namespace Code.Game.Gameplay.Player
[TabGroup("Misc")] public List<Collider> IgnoredColliders = new List<Collider>();
private Vector3 _moveInputVector;
private Vector3 _lookInputVector;
private Vector3 _internalVelocityAdd = Vector3.zero;
public Vector3 MoveInputVector { get; set; }
public Vector3 LookInputVector {get; set;}
public Vector3 InternalVelocityAdd { get; set; } = Vector3.zero;
private void Awake()
{
// Assign the characterController to the motor
@@ -90,15 +90,15 @@ namespace Code.Game.Gameplay.Player
Quaternion cameraPlanarRotation = Quaternion.LookRotation(cameraPlanarDirection, Motor.CharacterUp);
// Move and look inputs
_moveInputVector = cameraPlanarRotation * moveInputVector;
MoveInputVector = cameraPlanarRotation * moveInputVector;
switch (OrientationMethod)
{
case OrientationMethod.TowardsCamera:
_lookInputVector = cameraPlanarDirection;
LookInputVector = cameraPlanarDirection;
break;
case OrientationMethod.TowardsMovement:
_lookInputVector = _moveInputVector.normalized;
LookInputVector = MoveInputVector.normalized;
break;
}
}
@@ -117,8 +117,8 @@ namespace Code.Game.Gameplay.Player
.normalized;
}
_moveInputVector = inputs.MoveVector;
_lookInputVector = cameraPlanarDirection;
MoveInputVector = inputs.MoveVector;
LookInputVector = cameraPlanarDirection;
}
private Quaternion _tmpTransientRot;
@@ -139,11 +139,11 @@ namespace Code.Game.Gameplay.Player
/// </summary>
public void UpdateRotation(ref Quaternion currentRotation, float deltaTime)
{
if (_lookInputVector.sqrMagnitude > 0f && OrientationSharpness > 0f)
if (LookInputVector.sqrMagnitude > 0f && OrientationSharpness > 0f)
{
// Smoothly interpolate from current to target look direction
Vector3 smoothedLookInputDirection = Vector3.Slerp(Motor.CharacterForward, _lookInputVector,
Vector3 smoothedLookInputDirection = Vector3.Slerp(Motor.CharacterForward, LookInputVector,
1 - Mathf.Exp(-OrientationSharpness * deltaTime)).normalized;
// Set the current rotation (which will be used by the KinematicCharacterMotor)
@@ -215,10 +215,10 @@ namespace Code.Game.Gameplay.Player
currentVelocityMagnitude;
// Calculate target velocity
Vector3 inputRight = Vector3.Cross(_moveInputVector, Motor.CharacterUp);
Vector3 inputRight = Vector3.Cross(MoveInputVector, Motor.CharacterUp);
Vector3 reorientedInput = Vector3.Cross(effectiveGroundNormal, inputRight).normalized *
_moveInputVector.magnitude;
MoveInputVector.magnitude;
Vector3 targetMovementVelocity;
@@ -232,9 +232,9 @@ namespace Code.Game.Gameplay.Player
else
{
// Add move input
if (_moveInputVector.sqrMagnitude > 0f)
if (MoveInputVector.sqrMagnitude > 0f)
{
Vector3 addedVelocity = _moveInputVector * (AirAccelerationSpeed * deltaTime);
Vector3 addedVelocity = MoveInputVector * (AirAccelerationSpeed * deltaTime);
Vector3 currentVelocityOnInputsPlane =
Vector3.ProjectOnPlane(currentVelocity, Motor.CharacterUp);
@@ -282,10 +282,10 @@ namespace Code.Game.Gameplay.Player
}
// Take into account additive velocity
if (_internalVelocityAdd.sqrMagnitude > 0f)
if (InternalVelocityAdd.sqrMagnitude > 0f)
{
currentVelocity += _internalVelocityAdd;
_internalVelocityAdd = Vector3.zero;
currentVelocity += InternalVelocityAdd;
InternalVelocityAdd = Vector3.zero;
}
}
@@ -337,7 +337,7 @@ namespace Code.Game.Gameplay.Player
public void AddVelocity(Vector3 velocity)
{
_internalVelocityAdd += velocity;
InternalVelocityAdd += velocity;
}
public void ProcessHitStabilityReport(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,