I have this piece of code:
if (Input.GetMouseButton(2))
{
float mouseInput = Input.GetAxisRaw("Mouse X");
angle += mouseInput;
Vector3 offset = new Vector3(Mathf.Sin(angle), 0, Mathf.Cos(angle));
transform.position = offset;
}
It reads my mouse movements and then moves a sphere in a circle around the center of the worldspace.
The problem is, it doesn’t matter where I put the sphere before starting the game, it always snaps back to rotate around the worldspace center. I can’t figure out how to fix it.
Could anybody help me?