- Home /
Get axis not working with inputs
At the moment I'm following the tutorial by unity:
http://unity3d.com/earn/tutorials/projects/space-shooter/moving-the-player
The issue I'm having is that I can't get the vehicle to move. Is there anything stupid that i'm doing wrong. My code is the exact same and i've reset the input manager but still nada.
using UnityEngine; using System.Collections;
[System.Serializable] public class Boundary { public float xMin, xMax, zMin, zMax; } public class PlayerController : MonoBehaviour
{ public float speed; public float tilt; public Boundary boundary;
void Fixedupdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.velocity = movement * speed;
rigidbody.position = new Vector3
(
Mathf.Clamp (rigidbody.position.x, boundary.xMin, boundary.xMax),
0.0f,
Mathf.Clamp (rigidbody.position.z, boundary.zMin, boundary.zMax)
);
rigidbody.rotation = Quaternion.Euler (0.0f, 0.0f, rigidbody.velocity.x * -tilt);
}
}
Answer by tanoshimi · Jan 14, 2015 at 08:22 PM
FixedUpdate, not Fixedupdate.
Ugh, can't believe I didn't check thoroughly enough thank you so much!
Your answer
![](https://koobas.hobune.stream/wayback/20220613180425im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Virtual joystick in the new input system 0 Answers
New Unity Input System Touch Controls - Destroying GameObjects On Mobile 1 Answer
Finite State Machine 1 Answer
key remaping menu 0 Answers
Why is this script showing all keycodes except shift? 2 Answers