I need a function that calculates new OffSet position that takes 2 arguments old offset and rotation value (the rotation is only a float because the rotation is only happening around 1 axis always. I managed to find how to calculate facing direction based on rotation but I am having problem with offset. Found same topics like this but no answer except making child objects, which is not a good way. So a code like this
var offset = new Vector3(0f,5f,10f);
var rotationY = 90f;
var newOffset = NeededFunction(offset, rotationY);
The newOffset should be a Vector3 (10f,5f,0f). This is the funtion to calculate the facing direction
private Vector3 GetFacingDirection()
{
var rotY = transform.eulerAngles.y;
var vector = Quaternion.AngleAxis(rotY, Vector3.up)
* Vector3.forward;
return vector;
}