
Hello guys ! Same project, new problem ![]()
Every time I stop moving, my character faces north . How can I manage this situation ? I was thinking it will be fixed easily this morning but sun is gone and here I am.
Is there anyway to rotate my idle so it face my last direction ?
I found something interesting about passing a enum to the animator with cardinal direction but either the script is too old either I’m too noob to make it work.
Do I need to focus on my script ? Or can I fix it in my animator ? Big noob here don’t hesitate to explain obvious things !
Here’s a GIF of the situation:

Here’s the functions I call in my Update() :
private void ProcessInputs() {
if (useController) {
movement = new Vector3(Input.GetAxis("MoveHorizontal"), Input.GetAxis("MoveVertical"), 0.0f);
aim = new Vector3(Input.GetAxis("AimHorizontal"), Input.GetAxis("AimVertical"), 0.0f);
aim.Normalize();
isAiming = Input.GetButton("Fire");
endOfAiming = Input.GetButtonUp("Fire");
} else {
movement = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0.0f);
Vector3 mouseMouvement = new Vector3(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"), 0.0f);
aim = aim + mouseMouvement;
if (aim.magnitude > 1.0f) {
aim.Normalize();
}
isAiming = Input.GetButton("Fire1");
endOfAiming = Input.GetButtonUp("Fire1");
}
if (movement.magnitude > 1.0f) {
movement.Normalize();
}
}
private void Move() {
transform.position = transform.position + movement * Time.deltaTime;
}
private void Animate() {
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
animator.SetFloat("Magnitude", movement.sqrMagnitude);
}
private void AimAndShoot() {
Vector2 shootingDirection = new Vector2(aim.x, aim.y);
if (aim.magnitude > 0.0f) {
crossHair.transform.position = aim * 0.8f + thePlayer.transform.position;
crossHair.transform.rotation = Quaternion.identity;
crossHair.SetActive(true);
shootingDirection.Normalize();
if(endOfAiming) {
GameObject ammo = Instantiate(ammoPrefab, transform.position, Quaternion.identity);
ammo.GetComponent<Rigidbody2D>().velocity = shootingDirection * 3.0f;
ammo.transform.Rotate(0.0f, 0.0f, Mathf.Atan2(shootingDirection.y, shootingDirection.x) * Mathf.Rad2Deg);
Destroy(ammo, 2.0f);
}
} else {
crossHair.SetActive(false);
}
}
have a nice experience with playing god.