Hi, I am trying to move a GameObject (Player) toward the direction its child component (MOVER2) is facing. This simple line of code in the FixedUpdate () function of the Player script, work if left on its own moving automatically the Player in a direction, but when I insert it in the “if” statement it works only once each time I press the key, so that if I keep it pressed for a longer time, with the intention of making the movement repeat, nothing happen.
Is there a way to obtain a continuous movement using this code? or should totally change it with some other that specify the amount of movement for each frame? I know it is a simple matter but I am a beginner and a tried all the movement method I found out there, without success. Thank you for your time!
if
(Input.GetKeyDown(KeyCode.Space))
{
this.transform.position += MOVER2.transform.right * movespeed;
}