I have been trying to rotate my player along its local world y axis. I’m talking about a world object, with no parent, with the local axis handles. I want to rotate around that y axis. How would I achieve this?
Did you try transform.rotate.
public float RotateSpeed = 100;
// Update is called once per frame
void Update () {
transform.Rotate(0,Input.GetAxis("Horizontal") * RotateSpeed * Time.deltaTime , 0);
}
if you want to know more about check the docs here.
Hope this helps.
you can use Rotate method like this:
void Update() {
transform.Rotate(Vector3.up * 10 * Time.deltaTime);
}
and the default relativeTo is Space.Self
There’s a bit that’s tough to understand about your question due to some conflicting language, but I’ll do my best to offer as much and as thorough of answers as possible.
First off, the confusion comes from the statement of “Local World Axis” – Local and World are very different from each other, so it doesn’t make a whole lot of sense reading that.
The World rotation is relative to the environment. Up is up (Y-axis), north is north(Z-Axis), east is east(X-Axis), and so on.
The Local rotation is relative to individual objects. The object’s up is its personal “up” (Y-axis), its forward is its’ forward and nothing else’s (Z-axis), and its right is its own as well (X-axis).
Anyway, to switch which axis you rotate an object on in the editor specifically (addressed in response to “local axis handles”), you can either press “X” in the scene view to toggle between local and world manipulation (excluding scale, which is modifiable on local scale only), or you can find the button to toggle it near the top of the window by default.
I think what you are looking for is transform.rotate
public float RotSpeed = 100;
void Update()
{
transform.rotate(0,RotSpeed * Time.deltaTime , 0);
}
And you can check the unity docs about it from Here.