Why is this not moving?
I'm making a game and you are in space, piloting a ship. This script should control it, but it will not move. The particle systems are created properly but the ship doesn't move. It gives no errors
     public Rigidbody gObj;
     public float RCS_Power = 1;
     public GameObject RCS_Up;
     public GameObject RCS_Down;
     public GameObject RCS_Left;
     public GameObject RCS_Right;
     public bool RCS_enabled = false; //Set True in the inspectior
     void FixedUpdate(){
         Debug.Log (gObj.velocity);
         RCS_thrusters();
 
     }
     void RCS_ThrustX_Pos(){
         gObj.AddForce(1,0,0);
         GameObject nP = (GameObject)Instantiate(RCS_Right);
         Destroy(nP,2.3f);
     }
     void RCS_ThrustX_Neg(){
         gObj.AddForce(-1,0,0);
         GameObject nP = (GameObject)Instantiate(RCS_Left);
         Destroy(nP,2.3f);
     }
     void RCS_ThrustY_Pos(){
         gObj.AddForce(0,1,0);
         GameObject nP =  (GameObject)Instantiate(RCS_Up);
         Destroy(nP, 2.3f);
     }
     void RCS_ThrustY_Neg(){
         gObj.AddForce(0,-1,0);
         GameObject nP = (GameObject)Instantiate(RCS_Down);
         Destroy(nP,2.3f);
     }
 
     void RCS_thrusters(){
         if(RCS_enabled == true){
             if(Input.GetKeyDown(KeyCode.LeftArrow)){
                 RCS_ThrustX_Pos();
             }
             if(Input.GetKeyDown(KeyCode.RightArrow)){
                 RCS_ThrustX_Neg();
             }
             if(Input.GetKeyDown(KeyCode.UpArrow)){
                 RCS_ThrustY_Neg();
             }
             if(Input.GetKeyDown(KeyCode.DownArrow)){
                 RCS_ThrustY_Pos();
             }
         }
     }
 
 
              Answer by YoungDeveloper · Sep 05, 2015 at 06:03 PM
Should be
 Input.GetKey
 
              @YoungDeveloper Input.Get$$anonymous$$ey and Input.Get$$anonymous$$eyDown will do the same thing the difference is one checks for any action to the key and the other checks for only when it is presses down. I only want to know when the key is down. The particle systems wouldn't fire if my key event was wrong
It will fire once on the press, i think that applied force once is not enough to move the object (visually), have you tried bigger force strength?
Try this and see if it works
 void Update(){
     if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.A)){
         gObj.AddForce(1000f,0,0);
     }
 }
 
                 Just a small hint, do not rely on Input in FixedUpdate. It may fail sometimes.
Your answer
 
             Follow this Question
Related Questions
Move only if mouse click the Terrain 0 Answers
Movement input problem? 1 Answer
2D Object following the cursor without glitchyness at the center 0 Answers
Game Object jumps to z-axis 0 Answers
Jump is higher then normal 0 Answers