fix the auto-target to lock only when looking

else, look in the direction we're going
This commit is contained in:
jparent 2015-08-23 10:21:06 -04:00
parent 91cf1734ba
commit 4568e77871

View File

@ -89,6 +89,18 @@ public class ChildController : MonoBehaviour
transform.eulerAngles.z);
}
}
else {
_child.target = null; // no auto targeting when not actively pressing the joystick in a direction
// if player is not look with the right joystick, then face the direction we're going
// if left joystick is used, else we don't change the facing direction
if (xValue != 0 || zValue!= 0) {
transform.eulerAngles = new Vector3(
transform.eulerAngles.x,
Mathf.Atan2(xValue, zValue) * Mathf.Rad2Deg - 90,
transform.eulerAngles.z);
}
}
if (input.Ranges.ContainsKey("Throw")) {
_child.Throw();