Hi everyone,
My problem is very simple, my whole code is composed of very small parts, which makes it very maintainable and easy to use, but now I’m facing a problem, I have a rotation method which only function is rotate the given object:
public static void RotateObject(GameObject currentObject, float speed, float rotationAngle, int direction)
{
var value = Time.deltaTime * rotationAngle * speed * direction;
currentObject.transform.Rotate(0, 0, value);
}
The method works great but it obviously rotates the sprite too, now I would like to update it to keep the sprite in place but to rotate the object, I know that the most common method is create a parent, freeze the child rotation and rotate the parent, the problem is that this object is being used with other methods that require other components, including the animator, and it would be a mess, plus I only have one element in the entire game using the rotation method so update the whole code to handle this specific situation for this specific element does not make me happy, I would love to create a little solution that can be easily applied to this specific element some sort of “FreezeThisSpriteRotation(GameObject thisGameobjectWillNotRotateItsSprite)” method, I even thought that, knowing the rotation value, I could rotate the sprite in the opposite angle,keeping it in place , but I could not find anything about sprite rotation in the unity documentation beyond the flip ‘x’ and ‘y’
so my question is: is there a way of rotating the object but keep the sprite rotation in the original place without have to create a whole new object and set it as parent, just like doing a “flip x” and “flip y” flips the sprite without affect its rotation at all but to keep it steady instead.