- Home /
How can i rotate tyhorugh local axis?
Hello, this is my first question over here.
To explain my situation better i will tell you why i need to rotate through local axis. I'm relatively new to unity, so please feel free to correct me in any errors i make.
What i want to do is to make a 2.5d platformer game, in where the player character have some kind of boots that allows him to ignore gravity. So he can walk by the walls, and the ceilings, and jump from any of thos positions.
So, i want to be able to rotate through the Y axis. The proble with that is that when i walk in the walls Y axis would be X axis (the character walks through the x axis, don't know if that's the right way to go). Am i explaining it right??
Hope you can help me. Thanks
Answer by Eric5h5 · Sep 19, 2012 at 05:23 AM
You can always use relative movement using, for example, transform.forward. As opposed to Vector3.forward, which is the world Z axis, transform.forward is the object's local Z axis. So if you move in the direction of transform.forward, it's always forward from the perspective of that object regardless of how it's rotated in the world.
I think i have the move part of the problem solved, my problem is to make the character look left or right, so he can walk that way.
When he is walking by the walls that would be top/down cause de Y axis would seem like an X axis.
Thanks for the answer.