|
Does anyone know how to get a character to rotate and move in the direction of the key they press? Like pressing the left key makes the character look left and move that way? I tried this The turning direction is fixed but it still moves in only one direction. [Edit Berenger : Code formatting]
(comments are locked)
|
|
Affect moveDirection to the forward, not a new Vector3. If you want the rotation to happen slower, use Vector3.Lerp( transform.forward, moveDirection, Time.deltaTime * rotSpeed ), or even Mathf.Lerp, as your game isn't 3D you will only need one axe. Basically you are still using the same positive and negative axis directions with your horizontal axis, and translating them into local space, but they're still the same direction. Thus, use its forward axis, which you're already flipping by turning it, so you don't need the horizontal axis' positive or negative sign.
Mar 05 '12 at 07:23 PM
Alec Slayden
(comments are locked)
|
|
still have no idea... am really stupid about these Vector3 Can you provide a sample code please or fix these error ? I really can't figure this out sorry and thank for your help
(comments are locked)
|
