mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-24 00:50:59 +00:00
fix the auto-target to lock only when looking
else, look in the direction we're going
This commit is contained in:
parent
91cf1734ba
commit
4568e77871
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user