Hi, I need to disable an input, but if I use the Disable Input node it disables every inputs… There is a way to disable an input in particular without disable all the other inputs? Thanks!
I’ll explain… I’m creating a blueprint for the movement of a space ship. I add an axis input to accelerate (A key) and to brake (S key). With my current settings when I press the S key the spaceship moves backward instead of just stopping and turning the spaceship engine off (so enable gravity), which is what I need. I hope I was clear, can you help me please?
whats the context? and what type of input?
It s more about how your input is setup, if you use an example project, go to your inputs in project serrings and remove the S key from the move forward input axis
Then it’s up to you to create a new input called Brake and set the events you need.
.Maybe you can keep thoses inputs and add a branch, if move forward is < 0 set add movement input scale to 0
ok so it doesnt seem like you actually want to disable the input but rather you want to modulate how fast you are moving forward based on a key press. so its basically like the longer you press the w key the more you press the gas pedal in a car then even when the key is released you stay at that speed until you press the s key which is the equivalent to releasing the gas pedal.
ok so i threw together a little script or rather modified the basic movement from the templates to accomplish what i mentioned above. so basically i made the input small increments so it give the look of accelerating over time. i then created a variable to act as the “speed”. obviously when accelerating you add a positive number to the speed variable and the opposite for decelerating, then clamp the output to between 0 and 1 so that you cant move backwards. i then set the speed variable. lastly just plug it all into the add movement input node.
alternatively if you were making a 2d game with the ship on the bottom of the screen you could actually play with the gravity settings. get character movement → set gravity scale.
Thank you so much! I had not thought to clamp the axis value… I did it a little bit different from yours, but it works fine! But i’d really want to know anyway if there is a way to disable just some inputs… For example… If my spaceship is destroyed, it can’t move so I disable the movement inputs but I’d want that the camera controls keep working… there is a way to do it? Thanks!
is your camera part of the ship character/pawn? that could be a n issue when destroying the actor.
the easiest method i can think of to disable certain input at runtime due to an event would be to just have a bool variable and a branch node. what im imagining is that your input is either in the character or the player controller and you arent destroying the character but rather just the mesh or something like that.
another option is your just looking to disable the movement is to disable the movement component.
Yes, the camera is part of the pawn… But when I say the ship is destroyed, I don’t mean I use the Destroy Actor node… I simply mean, for example, that the ship is destroyed by anther player… The pawn is still in the scene… What I’d want to do is allow the player to watch the destroyed ship before restarting the game.
yea so basically ship health = 0 then disable input and do a ship destruction animation that the player can see and when thats done you respawn.
in that case i would probably disable the movement component so that the ship cant move, or you could just use a variable and a branch to stop the input from being processed.
Ok, I got it! Thank you!