- Home /
how to rotate my characters
Hi,
As the question suggests, I would like to know how to rotate my characters, Using the normal A and D out of WSAD keys. I've got the Input, I just need to know how to rotate. I'm Writing a game and am performing the scripting, without the actual models yet, so forget about animations. Also, I've got the back and Forth.
Thank You,
Koramere
Answer by Piflik · May 10, 2012 at 04:58 PM
transform.Rotate
But the Scripting Reference and almighty Google should tell you as much...
here is the line I'm using currently:
transform.rotate = (transform.rotate.x, transform.rotate.y - 0.1, transform.rotate.z);
Like I said I've got Input, just the "muscle" side of the code if you know what I mean.
I don't have the slightest idea what you mean...
I thought you already have the input...
Also I didn't mention the Scripting Reference for giggles...
var rot$$anonymous$$ult : float; //control how fast you want to rotate
function Update() {
transform.Rotate(Vector3.up * Time.deltaTime * Input.GetAxis("Horizontal") * rot$$anonymous$$ult, Space.World);
}
I meant I have input, I need to know the other side of things
What I should've mentioned earlier: I'm new to Unity, and only have a little scripting behind me. I am trying to become Independant in my development. So far I've only worked on the artist's side of development. I just know a few basics of scripting (variables, operators, comparisons, functions, Unity Specifics etc...). I want to know how all this works, not just copy and paste code. Could you please explain how this work.
Also: I have Input:
if (Input.GetAxis("Sideways") > 0) //if I'm pressing "A" (I created my own axis)
{
(what I need your help for)
}
Thank You, koramere