Get AI current direction?

If I understood right maybe you are looking for this node? If yes then connect the AI to the target and you can get the x,y,z values depending on if you need location or rotation.

254019-rotationlocation.png

Hey, fairly new with Unreal here; I’m making a 2D NPC that moves “ping/ponging” throughout 3 control points using InterpToMovement.

I’m able to change my controllable character animation through inputs responses, but I can’t make the NPC change his animation because there is no input.

Q: Is there a node/way to get the NPC current location/direction? So that way, for example, if he is moving down in the Z axis, then its shifts to “MoveDown” flipbook?

Thanks, hope I communicated well :slight_smile:

There is also get actor velocity, which may be more useful for your 2D setup…

@HarryHighDef It works better indeed!

@VortXGaming Thanks! That solved half of it, is there a way to attach these two branches to the event tick? (using a Sequence node or calling one of the branches in a construction script doesn´t seem to work)

][1]

Hello again . I suggest using Custom events ,one for each branch and then connect them to event tick .Otherwise you can check about the multigate node .Maybe this will work out for you. However I believe the sequence node should work so it is probably something else that is wrong. Good luck!

Hey . I can only link one of those custom events to the event tick, how do you connect both?. Checked multigate node, but as the sequence node, it fires them in order; although, since multigate node has a Loop boolean, it would be nice to change how “fast” does it switches from Out 0 to Out 1, but couldn’t find a way since I can only make it either loop or not loop, not change the way it loops.

Thanks a lot!

Hey. I wanted to say to connect the custom events serially. But anyway some usefull information . Let’s say you use a sequence node connected to an event tick node and in case 0 you are using a delay node and in case 1 you do not use a delay . The case 1 is not going to wait for the delay within case 0 to run its body. Although the case 0 is not going to be executed per frame multiple time but every time the delay duration is passed. (If you add delay node at the beggining just after case 0). Check this link for more info about this. https://answers.unrealengine.com/questions/715705/why-use-sequence-node.html

Now about the multigate node ,you can control how fast a variable value is changing over time by using a timeline (right click on blueprint and go to the bottom add timeline). Maybe you will be able to control that loop by a value with a timeline but I have never tried this before. I suggest using multigate not after event tick but after event begin play and then control the loop with timeline or delay.

To sum up I personally use in a project a sequence node in my main character after event tick and one after the event begin play nodes. I have like 7-8 cases to each one and they all working like a charm. (I use them to check various boolean variables so events are triggered in different times ) . I never had problem with the time that they are executed . So I have to conclude that the reason why you can not get the result you want is not the execution flow but some other mistake in your script.

You are welcome ! Have a nice day!

Yep, there probably is a mistake/lazy logic that I’ll try to make clearer. However, in this case, adding delay nodes to the sequence node and changing their duration worked fine.

Thanks for the patience and the well explained info, VortX :slight_smile: