- Home /
 
               Question by 
               Zitoox · Jun 18, 2016 at 11:20 PM · 
                charactercontrollerscriptingbasicscharacter.move  
              
 
              Creating a character controller
Hi! I am with a little problem here. I am trying to make a script to move my character.
My script works fine when i try to go forward and back, but i cannot make it to rotate. The script only makes the character to MOVE, not to rotate, and i didn't find any source,information or tutorial to make the character rotate while moving, using the keys A and D. Does anyone know how to do this? I am really confused about this.
Here's my script (it's pretty basic)
 using UnityEngine;
 using System.Collections;
 
 public class CharMovement : MonoBehaviour
 {
 
     public float speed;
 
     private Rigidbody rb;
 
     void Start()
     {
         rb = GetComponent<Rigidbody>();
     }
 
     void FixedUpdate()
     {
         float moveHorizontal = Input.GetAxis("Horizontal");
         float moveVertical = Input.GetAxis("Vertical");
 
         Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
 
         rb.AddForce(movement * speed);
     }
 }
               Comment
              
 
               
              Your answer
 
 
             