- Home /
How can I rotate around an already rotated axis?
First. Sorry if this is a duplicate, but I cannot find an answer that works for me. I have an object (sword) that, when it is in its (0, 0, 0) rotation it sits straight up with the handle at the bottom. However I do not always want it to be in that position. it does not have a parent object. I want to have the sword rotate 90 degrees on the x axis, causing it to look like it is laying down, but then I also want to have it "spiral" but it looks more like a Frisbee. It appears to me that its still rotating on the worlds y axis, and I want it to rotate on its new local y axis. Please help, I have been racking my brain.
Answer by Cambesa · Apr 12, 2017 at 08:07 AM
Perhaps something like:
transform.Rotate(Vector3.up, rotation, Space.Self);
transform.Rotate(transform.up, rotation, Space.Self);
Awe man! Yes! How could something so easy be so hard for me to find. I was getting ready to do the math myself. While I do know how to do it, I thought, surely Unity has a way to do this. Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220612115623im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Need help with sprite rotation 0 Answers
Limiting X-Axis rotation to 90 degrees and -90 degrees 1 Answer
reverse rotation of game object on button press 1 Answer
Recreating the rotation sphere in-game? 0 Answers
How to rotate mouse addresses? 0 Answers