Hi people, need help, please. I'm trying to animate an object. The animation changes the y position by transform. What happens though is that when I rotate it, it moves its pivot position, thus offsets the whole object. Here's the video: And the code: Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class AttackAnimation : MonoBehaviour { public float offset = 0.0f; private Animator _attackAnimation= null; private Vector3 center; // Start is called before the first frame update void Start() { _attackAnimation = GetComponent<Animator>(); } // Update is called once per frame void Update() { // Use this for initialization bool attack = false; //turn to cursor possition center = Camera.main.ScreenToWorldPoint(GetComponent<SpriteRenderer>().sprite.pivot); Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position; difference.Normalize(); float rotation_z = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(0f, 0f, rotation_z + offset); if (Input.GetMouseButton(0)) { attack = true; } _attackAnimation.SetBool("attack", attack); GetComponent<SpriteRenderer>().sprite.pivot = center; } } I should add that the code GetComponent<SpriteRenderer>().sprite.pivot = center; throws an error as the sprite.pivot is read only. No idea how to set it. Tx very much! V