- Home /
What are the method calls for moving left, right, and jump with the first person controller?
Going through a tutorial on 2D gaming from Mybringback.
http://www.mybringback.com/series/unity-2d-game-development/
It's adapting first person controls to a 2D game. I'm now trying to build a game based on Mybringback's project. I want to make it so that the character moves left, right, or jump with swipe gestures.
I got the gesture code down, but I cannot find a way to access the method call that triggers jumping or movement. I could try and make it myself, but I prefer the more stable coding that came with the First Person Controller.
I tried googling but can't come up with anything.
Answer by robertbu · Dec 20, 2013 at 03:21 PM
The first person controller is built on three components, a CharacterController, a CharacterMotor, and a FPS. The FPS drives the CharacterMotor which drives the CharacterController. In the project window you can type FPS into the search bar at the top, or you can just add a FPS Input Controller to a game object then double click on the FPS script in the Inspector.
The two lines you are looking for are here:
motor.inputMoveDirection = transform.rotation * directionVector;
motor.inputJump = Input.GetButton("Jump");
And the rest of the script is pretty easy to understand.
Thanks! I've already begun to adapt Touch Screen controls. Only the horizontal movement was successfully adapted so far. I plan on implementing the jump feature soon.
Your answer
Follow this Question
Related Questions
Unity 2D Mobile Game Drawing Mechanic 0 Answers
How do i need to change this script for mobile? 1 Answer
Mecanim for Mobile Devices 2 Answers
OTA download limits on mobile platforms 0 Answers
Different animations on mobile 0 Answers