fix: modifications to direction handling for when move stick is pressed lightly
This commit is contained in:
@@ -64,8 +64,8 @@ namespace Reset.Units{
|
|||||||
targetDirection = (Camera.main.transform.rotation * targetDirection.ToVector3()).ToVector2();
|
targetDirection = (Camera.main.transform.rotation * targetDirection.ToVector3()).ToVector2();
|
||||||
|
|
||||||
// Deadzone
|
// Deadzone
|
||||||
if (targetDirection.magnitude < .08f) {
|
if (targetDirection.magnitude < .1f) {
|
||||||
targetDirection = Vector2.zero;
|
targetDirection = resolvedMovement.moveDirection.RawWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Raw Direction (this is used by the camera later)
|
// Set Raw Direction (this is used by the camera later)
|
||||||
@@ -96,6 +96,8 @@ namespace Reset.Units{
|
|||||||
newDirection = Vector2.SmoothDamp(currentDirection, targetDirection, ref refVelocityDirectionChangingHardness, data.directionChangingSoftness.Value * data.airDirectionDecay.Value * Time.deltaTime);
|
newDirection = Vector2.SmoothDamp(currentDirection, targetDirection, ref refVelocityDirectionChangingHardness, data.directionChangingSoftness.Value * data.airDirectionDecay.Value * Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newDirection = Vector3.Slerp(resolvedMovement.moveDirection.World, newDirection, controls.rawMoveInput.magnitude);
|
||||||
|
|
||||||
// Commit the new direction
|
// Commit the new direction
|
||||||
resolvedMovement.moveDirection.World = newDirection;
|
resolvedMovement.moveDirection.World = newDirection;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user