I have an error that says, "ArgumentException: Input Axis vertical is not setup.’
I’m new please help
I used the third person tutorial:
[/code]
My code is:
using JetBrains.Annotations;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class tpm : MonoBehaviour
{
public CharacterController controller;
public float speed = 6f;
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;
if(direction.magnitude >= 0.1f)
{
controller.Move(direction * speed * Time.deltaTime);
}
}
}
In programming it is critical to get the spelling, capitalization and punctuation 100% perfect.
Take a look in the InputManager settings and verify that the capitalization on name of the input axes matches what you are using above PRECISELY, specifically for the one that the engine is complaining about.
You have gone and deleted your post, AFTER getting the full benefit of an earlier post that had your answer. Why on earth would you do that? You have now prevented the next person who has your problem from learning anything!
Do NOT delete your posts, even after you figure it out. You completely defeat the purpose of the forum, WHICH YOU JUST USED TO SOLVE YOUR PROBLEM BY LOOKING AT AN OLD POST!!!
there is an error that says, “The variable controller of tpm has not been assigned.” tpm being the script name. I have character controller on thirdpersonplayer, my model, but I don’t know how to incorporate it in the script. I was trying to make my model go to the direction it was moving, but when I put the code in, the moving just stopped.
using JetBrains.Annotations;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class tpm : MonoBehaviour
{
public CharacterController controller;
public float speed = 6f;
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;
if(direction.magnitude >= 0.1f)
{
float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, targetAngle, 0f);
controller.Move(direction * speed * Time.deltaTime);
}
}
}