Hello,
I’m following the video about Visual Script and the video about getting the Input Axis doesn’t work, for an unknown reason, when i push play button, the player go always on the top left… but i can control with the arrow keys or ASWD keys, but if i touch nothing, the player always go to top left…
What I can see of your script graph looks correct, though it’s cut off. However, the movement you describe sounds like what was done in an earlier lecture for the EnemyController script graph, is it possible that the player isn’t using the correct script graph? Check that you have the PlayerController script graph in the player’s Script Machine, and that there isn’t a second Script Machine added to the player with a different Script Graph.
Hello, thanks for your reply, i’ve checked if Player object have playercontroller and it’s ok. Is it possible i’ve missed something in the Project Settings?
If you’ve changed something in the Input Manager of Project Settings it could cause unexpected behaviour, or it’s possible that you’re getting input from something other than the arrow and ASWD keys. The Horizontal and Vertical will also respond to a gamepad/joystick/certain mouses.
If you mean the distance variable, that shouldn’t be connected any longer, so its values won’t matter. If it is connected somewhere, that could be the issue! The only Graph Variable currently used should be movementSpeed which I can see in your picture. Just for clarity, the full picture should look like this:
If all of these things look the same in your project, the problem is likely caused elsewhere. You could check something like the Rigidbody 2D and make sure Gravity Scale is set to 0
Those pictures show that something is sending input information. The result of the Vector 3 Create should be (0.00, 0.00, 0.00) when there’s no input, the results of the Multiply nodes will also be 0 since any value they get from Get Delta Time and movementSpeed will be multiplying by 0.
Some device on your system is sending input information through the Get Axis nodes. In the Input Manager there is actually a second set of Horizontal and Vertical which are used for controllers by default, but if you don’t have a controller connected that shouldn’t be causing the issue.
Someone in an unrelated Ask thread had a special mouse which was sending input information, so it could be something like that, but without knowing what’s connected to your system there’s no way to guess. If you can’t find what that is, a drastic measure would be to start changing things in the Input Manager, like renaming the second Horizontal and Vertical set to make sure they aren’t influencing the Script Graph, but that’s not an ideal solution. If it’s possible, test your game on a different system and see if the same problem exists there.
I’ve tested on another computer as you say, and same thing. I’ve tested with another input like Mouse X and Mouse Y, it’s working good! i really not understand why! i have only a mouse on my computer, and i’ve tested to get the mouse on my and to be sure it’s not moving, but not changed the result! :\
No problem, thank you for your help.
I think i’ve found a soluce, i’ve deleted the Horizontal and Vertical for gamepad … and now everything are ok!
I don’t know why i have no gamepad on my computer. maybe is a conflit with XBOX soft, don’t know…
Eventually you’ll want to learn about the newer Input System, which should help you avoid these issues with input.
It’s definitely strange that the gamepad input would give that result when you have no gamepad connected. But I am glad that a solution could be found!