I want a rotating sphere to change its axis of rotation by a small value everytime i press a key.
I have used transform.rotate (xAxis,yAxis,zAxis) but if I add a value to any of the axis to change the axis of rotation the speed of rotation also changes. I want the speed to be static.
Basically those parameters you have in transform.Rotate() are speed values. E.g. you are telling it to do xAxis degrees around the x axis in this frame. If you increase it, it means it rotates more degrees in that axis in a frame, thus more speed.
I’m not on PC to test but here’s a suggestion:
You want static speed, which MIGHT mean the overall degrees must be kept same (xAxis + yAxis + zAxis = same on all frames). You want more speed/degrees on a particular axis, which means you must “steal” some degrees from the other axis. The fairest thing to do is to steal half of the value you add from each of the other axis. E.g. you want to add 10 degrees to xAxis, which means you have to reduce yAxis by 5 and zAxis by 5, so the overall sum is kept the same.
You’re not using Rotate the right way. There are different ways to use it and the one you need is this one:
public void Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);
so the rotation angle is constant, all you change is the axis.