If there is anyone with UE4 blueprint experience on here, would be great.Whenever moveCharacter is run (by pressing wasd keys) it moves the character along a grid. Problem is, i am able to move the character up while also moving it to the right at the same time. SO, how do I make this so it doesn't execute on of four when one is already being executed?
>>527471So I assume you want the pawn to only move in 1 direction at a time, ignoring other input yes?Here's a quick setup I threw together. Mind it will only trigger once per action (so if the action is suppose to repeat whilst the key is held you might need to use Tick repeat the last key action).
>>527480Its really complicated though because I use UMG touch buttons for moving since it's a mobile game. This means I can't use the equal key node. Movement is already tick for holding the button purposes
>>527577OK I can't check the multitouch because I've only got KB+M. But I made a UMG widget with 2 buttons. Bound 'Press' & 'Release' events to each button. I used an enum for the actions.So, when a button is pressed it checks that no other buttons are pressed & opens the gate. The tick event flows through the gate and repeats the move. When a button is released it confirms that it is the same button & closes the gate. The stop move must be sent before you close the gate.A switch statement selects which action is active and sets up the move. Pic is the UMG Blueprint.
>>527577>>527592And the enum setup. Note this is a separate object you create in the content browser under Blueprints->Enumeration. Also, the 'action' variable in the Blueprint must be of this type (in my case 'BE_Action').
>>527471I've never used UE4 but this seems like something you'd use logic gates for in a digital logic setting.Googling led me to this Gate node, if there was one with three "close" inputs (equivalent of a four-input AND with three of the four inputs inverted) you could stick them between each of the outputs of the Switch node and the Branch nodes and then have the remaining three inputs connect to the other outputs of the Switch.Again, not sure if this is how it works, but as a passing computer engineering student that's what I would do.
>>527592>>527593The gate node was exactly what I was looking for. Not being able to move multiple directions at once is working fine now.So right now it moves the character every tick as long as input is held, with a delay of 0.1 secs. Without this delay it moves way too fast. Only this results in the character teleporting 100 cm's every 0.1 sec. I want it to move smooth as long as input is held, and stop every 100 cm's so it stays on the grid. I tried using linear interpolation with no success. How can i achieve this? Maybe I can round the world location to a hundred when it stops moving, but I don't know how to go about it.
>>527661A quick way to achieve smooth motion at a constant speed is to multiply your target speed by World Delta Seconds. This would also allow you to get rid of the 0.1 delay. You should be doing this anyway because without that delay your pawn speed is tied to your frametime (i.e. your pawn will move quicker at 60fps than 30fps).Otherwise why don't you build a vector of the target grid point (i.e. V(0, 200, 300)) which you update with input and use a vinterp to move to it. I'll have a look at it in a bit.
>>527471You might be better off asking in /v/'s or /vg/'s gamedev threads, this isn't really modeling so much as game design>>527661lerp maybe? It sounds like you want the smooth-yet-snappy movement I've seen in some games where it rapidly acc/decelerates, but I'm unsure>>527672This as well, any time-based actions need to be multiplied by delta seconds to keep it dependent on time and not framerate (otherwise you'd have people on good phones/comps zooming around while people with low FPS inch their way across)
>>527661>>527672Right I've had a crack at, made my own grid based pawn. So using WASD I move the box is units of 100 up,down,left, right (top-down camera). I do this by setting a vector called 'Step', which will be used to change the 'Target' vector.Then once the gate is open the 'Target' vector is updated once a second. I then used a vinterp to move the pawn from its current location to the target location. I use bool to check if on target, so when the key is release the pawn will finish the move.My pawn uasset:https://drive.google.com/file/d/0B9E7sO5KxRdzYzBlUzlnekFzNEE/view?usp=sharingYou should be able to import this into your project and then change the pawn type in your gamemode to B_GridPawn.The only issue is a lock-up with the first few movements. I don't know if it is an initialisation thing or where it tries to loop.