Hello everyone! I’m trying to do a basic walk and jump script but for some reason my character don’t jump when it’s moving on diagonals by arrow keys, except up+right.
if(canMove==true){
var direction = Vector3(0, Input.GetAxisRaw("Vertical"), Input.GetAxisRaw("Horizontal"));
GetComponent.<Rigidbody>().transform.Translate(direction * speed * Time.deltaTime);
}
if (Input.GetButtonDown("Jump")){
GetComponent.<Rigidbody>().AddForce(new Vector3(0, 5, 0), ForceMode.Impulse);
}
I read in other threads that this problem may happen for keyboard limitations, but it responds well in other games. Any sugestion?
I am having the same problem but using character controller.
I also dont think it has anything to do with keyboard limitations because jump works with other diagonals and all fingers smushed down on all the keys. just not at all when running backwards and or only sometimes on some diagonals. weird huh. probably has something to do with isGrounded…
also, up right, sounds like something to do with positive values vs negative on the movement axes?
debug commencing.
the arrow keys and analog stick work in all directions with jump. WASD keys are not working back left and back right.
ALSO, jump button on controller works with WASD back diagonals. (again, not with space bar.)
possibly because this bit of this code im using?
Vector3 move = transform.right * x + transform.forward * z;
will try changing it. also tried changing around some settings in player input project settings. nothing.
sounds like either windows or unity doesnt like those keys and space bar working together…
–
confirmed, works just fine on my laptop (minus the god awful performance).
must be my ancient logitech USB mini keyboard. bought it decades ago for ps2 FFxi. kept it because its so damned great. whoops. (yep also confirmed space bar does NOT work on web browser when pressing diagonal keys together)
will buy new keyboard ASAP.