change: player facing direction is now forced to "static" from "towardstarget" if there is no target. player always rotates towards target instead of only when moving
This commit is contained in:
@@ -143,7 +143,10 @@ namespace Reset.Units{
|
||||
case PlayerFacingDirection.TowardsTarget:
|
||||
// Look directly at the target
|
||||
if (lockOnManager.mainTarget == null) {
|
||||
Debug.LogError("Trying to rotate towards a target but there is no target. Not setting a rotation");
|
||||
Debug.LogError("Trying to rotate towards a target but there is no target. Forcing rotation to Static and continuing");
|
||||
data.facingDirection.Value = PlayerFacingDirection.Static;
|
||||
data.facingDirection.currentValue = PlayerFacingDirection.Static;
|
||||
|
||||
targetRotation = transform.rotation;
|
||||
break;
|
||||
}
|
||||
@@ -175,9 +178,9 @@ namespace Reset.Units{
|
||||
DebugOverlayDrawer.ChangeValue("Rotation", "Target Rotation", targetRotation.eulerAngles);
|
||||
|
||||
// Add the current input into the created rotation
|
||||
if (inputMovement.magnitude > .05) {
|
||||
if (data.facingDirection.Value == PlayerFacingDirection.MatchCamera || data.facingDirection.Value == PlayerFacingDirection.TowardsTarget) {
|
||||
resolvedMovement.rotation = targetRotation;
|
||||
} else if (data.facingDirection.Value == PlayerFacingDirection.MatchCamera) {
|
||||
} else if (controls.rawMoveInput.sqrMagnitude > .1){
|
||||
resolvedMovement.rotation = targetRotation;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user