Question by
UnityNewbie7 · Jan 28, 2021 at 05:38 PM ·
movementvector3getaxis
Need help about getAxis
I'm trying to put it as if statement: movement = new Vector3(Input.GetAxis("Horizontal"), 0, 0); inputJumping();
I tried different variations and could not find a solution. I want to make it if the player input is horizontal { the movement script}
Rigidbody rb;
public Vector3 movement;
// Start is called before the first frame update
void Start()
{
rb = this.GetComponent<Rigidbody>();
currentState = State.Idle;
}
// Update is called once per frame
void Update()
{
[B]movement = new Vector3(Input.GetAxis("Horizontal"), 0, 0);
inputJumping();[/B]
}
void FixedUpdate()
{
RespondToWalking(movement);
}
void RespondToWalking(Vector3 direction)
{
Comment
What is not working with your current script? For sure, a part of it is missing from your original post.
Your answer
Follow this Question
Related Questions
Getting vector 3 to move relative to camera 0 Answers
Move a object along a vector 1 Answer
GameObject doesn't move 1 Answer
Smooth Forward Movement with a CoRoutine 1 Answer
Vector3.Lerp not moving object backwards 0 Answers