var moveDirection = Vector3.zero;
var speed = 1.0;
if FixedUpdate ()
{
moveDirection = new Vector3(0, 0, Input.GetAxis("Vertical")*speed);
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
}
if(Input.GetAxis("Horizontal") < -.1 )
{
transform.Rotate(Vector3.up * -.6);
particleEmitter.enabled = true;
}
if(Input.GetAxis("Horizontal") > .1)
{
transform.Rotate(Vector3.up * .6);
particleEmitter.enabled = true;
}
}
when i press up arrow it moves moves forward and when press left and right arrow it turns left and right direction.
when i release the up arrow i want to add a constant force along the direction now the character is facing.
i want to translate(move) the character to certain constant distance after the release of the up arrow.
i want to move through the direction now the character is facing. it should happen after the release of up arrow only.
i want to add force or translate the character the direction now the character is facing after the release of up arrow.
i tried a lot not getting the output.
(Input.GetKeyUp (KeyCode.UpArrow)) but not working for me