[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k] [s4s] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Settings Home
/3/ - 3DCG

[Advertise on 4chan]

Thread archived.
You cannot reply anymore.

File: alreadytriedbooleans.jpg (119 KB, 1139x731)
119 KB
119 KB JPG
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?
File: BP_LOCK.jpg (128 KB, 1092x707)
128 KB
128 KB JPG
So 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).
Its 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
File: BP_LOCK_v2.jpg (218 KB, 1733x802)
218 KB
218 KB JPG
OK 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.
File: BP_LOCK_v2_ENUM.jpg (41 KB, 622x566)
41 KB
And 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').
File: Gate_Example.jpg (6 KB, 210x191)
6 KB
I'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.
File: allBlueprints.jpg (568 KB, 1564x1793)
568 KB
568 KB JPG
The 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.
A 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.
You might be better off asking in /v/'s or /vg/'s gamedev threads, this isn't really modeling so much as game design

lerp 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

This 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)
File: MovePawn.jpg (319 KB, 1928x1080)
319 KB
319 KB JPG
Right 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:

You 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.

[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.