Left Right Inputs not working
Hi, i'm having a problem : i used the Import package => Character => ThridPersonCharacter but going forward and backward wasn't working. Then i tried to make my own script :
"using UnityEngine; using System.Collections;
public class Thirdpersoncontroler : MonoBehaviour {
float moveHorizontal;
float moveVertical;
float moveSpeed = 10;
float rotationSpeed = 80;
void Update() {
moveHorizontal = Input.GetAxis("Horizontal");
moveHorizontal = Input.GetAxis("Vertical");
transform.Translate(Vector3.forward*moveVertical*Time.deltaTime*moveSpeed);
transform.Rotate(Vector3.up*moveHorizontal*Time.deltaTime*rotationSpeed);
}
}" But the problem remains. When I delete the line " transform.Translate(Vector3.forward*moveVertical*Time.deltaTime*moveSpeed);" I can still move my cube with the Up and Down arrows. It's not a Kinematic problem since Rigidbody isn't activated.
I also checked in Edit => Project Settings => Input if something was wrong but everything is set up correctly. I reseted it, values and checking didn't change.
I think it may be a Register problem but i don't know how it works. I'm on Unity 5.3.4f1 Personal running on Windows 10, everything updated, Asus G75VX gaming laptop.
Some guys seem to have the same problem but i couldn't find the answer. Thanks
This is why I prefer to have manual, specific input conditions rather than using shortcuts like Horizontal
and Vertical
.
As far as I am aware they listen for all mouse, keyboard, joystick, controller etc inputs dubbed horizontal and vertical ie: the arrow keys too. The documentation isn't actually especially clear (as usual) but the second example there is written just for mouse Y and X.
you might have another script attached to the object & in your script above you have assigned moveHorizontal
to both Input.GetAxis("Horizontal");
& Input.GetAxis("Vertical");
& also i am nut understanding what are you trying to do Vector3.forward
is used to send object to specific position if you want just to move object by input we should do something else so tell us exactly what you want.