change: clean-up and tweaks to some swinging behavior
This commit is contained in:
@@ -3,7 +3,6 @@ using NUnit.Framework.Internal;
|
||||
using UnityEngine;
|
||||
using ParadoxNotion.Design;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine.Serialization;
|
||||
using Quaternion = UnityEngine.Quaternion;
|
||||
|
||||
@@ -125,26 +124,11 @@ namespace Reset.Units{
|
||||
additionalMoveDirection += inputDirection.normalized;
|
||||
additionalSpeed = power;
|
||||
}
|
||||
|
||||
public void SmoothToDirection(Vector3 desiredDirection, float value, out Vector3 referenceDirection){
|
||||
// referenceDirection = outputMoveDirection;
|
||||
|
||||
additionalMoveDirection = Vector3.Slerp(outputMoveDirection, desiredDirection, value);
|
||||
|
||||
referenceDirection = outputMoveDirection;
|
||||
}
|
||||
|
||||
public void SmoothToSpeed(float desiredSpeed, float smoothing, out float referenceSpeed){
|
||||
|
||||
public void SmoothToSpeed(float desiredSpeed, float smoothing){
|
||||
additionalSpeed = Mathf.Lerp(additionalSpeed, desiredSpeed, smoothing * Time.deltaTime);
|
||||
|
||||
referenceSpeed = additionalSpeed;
|
||||
}
|
||||
|
||||
// public void SmoothToGravity(float desiredGravity, float smoothing, out float referenceGravity){
|
||||
// outputMoveDirection.y = Mathf.Lerp(outputMoveDirection.y, desiredGravity, smoothing);
|
||||
// referenceGravity = desiredGravity;
|
||||
// }
|
||||
|
||||
|
||||
public void SetNewDirection(Vector3 inputDirection){ // NOTE: If smoothing desired add a default bool for smoothing maybe?
|
||||
additionalMoveDirection = inputDirection.Flatten(null, 0f, null);
|
||||
}
|
||||
@@ -208,7 +192,6 @@ namespace Reset.Units{
|
||||
|
||||
// Smooth movement. Use deaccel smoothing if the input magnitude is lower, and accel smoothing if it's higher
|
||||
// Also checks when grounded to only use Slerp on the ground
|
||||
|
||||
if (targetNoY.magnitude > currentNoY.magnitude) {
|
||||
if (controller.isGrounded){
|
||||
slerpedValue = Vector3.Slerp(currentNoY, targetNoY, data.accelerationSmoothing * Time.deltaTime);
|
||||
@@ -332,10 +315,7 @@ namespace Reset.Units{
|
||||
|
||||
// Construct the direction and move
|
||||
Vector3 finalDir = moveXZDir + moveYDir;
|
||||
|
||||
|
||||
controller.Move((Camera.main.transform.rotation.Flatten(0, null, 0) * finalDir) + addDir);
|
||||
|
||||
controller.Move((Camera.main.transform.rotation.Flatten(0, null, 0) * finalDir) + addDir);
|
||||
}
|
||||
|
||||
void LateUpdate(){
|
||||
@@ -366,9 +346,6 @@ namespace Reset.Units{
|
||||
// Decay the direction
|
||||
if (inputMovement.magnitude < currentNoY.magnitude) {
|
||||
additionalMoveDirection = Vector3.Slerp(additionalMoveDirection, Vector3.zero,data.accelerationSmoothing * Time.deltaTime);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
// float deaccelValue = data.deaccelerationCurve.Evaluate(inputMovement.magnitude);
|
||||
additionalMoveDirection = Vector3.Lerp(additionalMoveDirection, Vector3.zero, data.deaccelerationSmoothing * Time.deltaTime);
|
||||
|
||||
Reference in New Issue
Block a user