fix: more movement and observer tweaks and fixes

This commit is contained in:
Chris
2025-07-30 13:22:36 -04:00
parent ae1908013d
commit 598fa9f6fc
8 changed files with 188 additions and 76 deletions

View File

@@ -90,13 +90,16 @@ namespace NodeCanvas.Tasks.Actions {
break;
case PlayerFacingDirection.Movement:
// Check magnitude to avoid the "Look rotation viewing vector is zero" debug
if (controls.rawMoveInput.magnitude == 0) { break; }
// Set desired rotation to input direction, with respect to camera rotation
if (agent.isGrounded){
if (controls.rawMoveInput.magnitude == 0) { break; }
targetRotation = Quaternion.LookRotation(currentMoveDir) *
Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0f, null, 0f));
} else {
if (airMoveDirection.value.magnitude == 0) { break; }
targetRotation = Quaternion.LookRotation(airMoveDirection.value);
}
break;