
It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, I'm a novice programmer returning after some years and essentially reforming my sloppy practices. I'm currently breaking up my movement script into two parts, one for the actual meat of the functions and the other for player inputs. The script is already an amalgamation of things I learnt, either wrote myself or used from tutorials etc. I have two lines of code to figure out, then I can move them into their appropriate scripts. Here are the lines, please keep in mind that this is a big script and I can't like it all here, also the names of stuff isn't great and is one of the things I'm changing once I have it separated out and working.
" transform.Rotate(0, Input.GetAxis("Horizontal") * rotationSpeed * Time.deltaTime, 0);"
Input.GetAxis("Horizontal"), this is the line I'm trying to change.
"Vector3 v = (transform.TransformDirection(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"))) * (velocity > 0 ? velocity : 1f));"
new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")), and this line as well.
What I've tried already- I've tried using a vector variable in it's place and get the error can't convert a vector into a float.
How would I go about changing these inputs to float variables that can be used here instead. As I have the actual inputs from the player already in their own functions. It can't be an actual input either, as I will need this code later on for AI characters. Any help would be greatly appreciated. If my question isn't clear, I'm more than happy to try and explain more.
Solved, such a silly thing, I was over thinking it.
"Input.GetAxis("Horizontal")
new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"))"
input.x and input.y in their places instead.