- Home /
Move character without Input.GetAxis
I was thinking about writing a custom Input Manager to allow key remapping at runtime but I decided that it would be a lot of struggle. So, instead, I need to make character move left or right without Input.getAxis. Can someone help me with this? I need the same behaviour like with Input.GetAxis but I need to only use Input.GetKey/Down/Up. Something like this:
// rb is a rigidbody ;
rb.velocity = new Vector2(move * maxSpeed, rb.velocity.y) ;
// move must be a value between -1 and 1
// maxSpeed is 2f in my case
Please! I've been stuck with letting the player set custom controls for days!!
Answer by Cuttlas-U · Sep 09, 2017 at 07:48 PM
hi; for moving u can use many different methods some are physical and some are not;
for input i did not get u actually can u explain a little more?
I mean that ussualy I would have set move
to Input.GetAxis("Horizontal")
but I can't use that now because I need to be able to remap keys at runtime. What I am trying to achieve is writing a function that does the same as Input.GetAxis
but takes 2 $$anonymous$$eyCode arguments for positive/negative buttons, one float for sensibility and one float for gravity.
Your answer
