Issues Getting my GameObject to both Move Forward and Jump properly.
I'm having an issue where my gameObject barely jumps at all. I think it has something to do with moveDirection. I tried doing an p.AddForce(moveDirection * Time.DeltaTime) which lets the GameObject jump properly but won't move.
using UnityEngine; using System.Collections;
public class Controller : MonoBehaviour {
 public float jumpHeight = 8f;
 public Rigidbody p;
 public float speed = 1;
 public float runSpeed = 3;
 public Vector3 moveDirection = Vector3.zero;
 // Use this for initialization
 void Start () {
     p = GetComponent<Rigidbody> ();
     p.velocity = Vector3.zero;
 }
 
 // Update is called once per frame
 void Update () {
     if (Input.GetKeyDown (KeyCode.Space)) {
         p.AddForce(new Vector3(0, jumpHeight, 0), ForceMode.Impulse);
     }
     Move ();
 }
 void Move (){
     if(Input.GetKey(KeyCode.D))
     {
         transform.Rotate(Vector3.up, Mathf.Clamp(180f * Time.deltaTime, 0f, 360f));
     }
     if(Input.GetKey(KeyCode.A))
     {
         transform.Rotate(Vector3.up, -Mathf.Clamp(180f * Time.deltaTime, 0f, 360f));
     }
     
     moveDirection = new Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
     moveDirection = transform.TransformDirection(moveDirection);
     
     if(Input.GetKey(KeyCode.LeftShift))
     {
         moveDirection *= runSpeed;
     }
     else
     {
         moveDirection *= speed;
     }
     p.velocity = moveDirection;
 }
}
               Comment
              
 
               
              Also when p.velocity = moveDirection is commented out, the gameObject can not move.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                