fix: non player units no longer rotate with camera
This commit is contained in:
@@ -62,8 +62,10 @@ namespace Reset.Units{
|
|||||||
Vector2 targetDirection = new Vector2(directionProvider.Direction.x, directionProvider.Direction.y);
|
Vector2 targetDirection = new Vector2(directionProvider.Direction.x, directionProvider.Direction.y);
|
||||||
|
|
||||||
// Rotate input by camera rotation (instead of rotating the output direction by camera rotation)
|
// Rotate input by camera rotation (instead of rotating the output direction by camera rotation)
|
||||||
targetDirection = (Camera.main.transform.rotation * targetDirection.ToVector3()).ToVector2();
|
if (GetComponent<Player>()) {
|
||||||
|
targetDirection = (Camera.main.transform.rotation * targetDirection.ToVector3()).ToVector2();
|
||||||
|
}
|
||||||
|
|
||||||
// Deadzone
|
// Deadzone
|
||||||
if (targetDirection.magnitude < .1f) {
|
if (targetDirection.magnitude < .1f) {
|
||||||
targetDirection = resolvedMovement.moveDirection.RawWorld;
|
targetDirection = resolvedMovement.moveDirection.RawWorld;
|
||||||
|
|||||||
Reference in New Issue
Block a user