Quantcast
Viewing latest article 18
Browse Latest Browse All 114

Character is moving forward and backward on it's own

So im just starting using unity and trying the free asset robot kyle since kyle have no animation i have to find another character with walking and i found one. I already have animation component and animator just to be sure, i don't know about the code if it is right or their are still missing to make kyle move by keyboard control. i already check the setting for input and it's good and also their is no problem with the vjoy stick in my laptop. i have no idea what make kyle or my character move on it's own. private string moveInputAxis = "Vertical"; private string turnInputAxis = "Horizontal"; public float rotationRate = 360; public float moveSpeed = 2; void Start() { } // Update is called once per frame void Update() { float moveAxis = Input.GetAxis(moveInputAxis); float turnAxis = Input.GetAxis(turnInputAxis); ApplyInput(moveAxis, turnAxis); } private void ApplyInput(float moveInput, float turnInput) { Move(moveInput); Turn(turnInput); } private void Move(float input) { transform.Translate(Vector3.forward * input * moveSpeed); } private void Turn(float input) { transform.Rotate(0, input * rotationRate * Time.deltaTime, 0); } }

Viewing latest article 18
Browse Latest Browse All 114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>