- Home /
Question about angrybots player controls
Hi, I'm a noob. I've been playing around with the angrybots scripts. I'm trying to understand where in the code it pulls the keyboard input to control the Player. I've setup a new scene with a plane and capsule. I've named the capsule Player and assigned the "Free Movement Motor" and "Player Move Controller" scripts. I can get the capsule to move around the screen just like the angrybots character. I just don't understand where it is getting the WASD keyboard inputs. I can see the code that controls the camera. Is there a tear down that anyone can point me to. I would really like to understand. Thanks in advance for the help!
Answer by Landern · Jan 04, 2013 at 04:31 AM
It is in the update in the PlayerMoveController.
The thing that may be tripping you up is that the reference it is making is from the Input(Edit->Project->Input->Expand Axes) settings.
In the update method/function you will notice is:
motor.movementDirection = Input.GetAxis ("Horizontal") * screenMovementRight + Input.GetAxis ("Vertical") * screenMovementForward;
When you expand and look at the settings for Input, you should see Horizontal and Vertical. Expand them, you will see the defined keys, etc.
Thank you so much! I can't tell you how many hours I've wasted trying to figure this out. I'm trying to give you points, but my account is too new. :( I hope you have any amazing day!
Your answer