Gameplay Ability Task "Move To" with callback

Hi there!

I’d like to know, is there any prepared logic for a basic Move To Location / Actor GAS ability task that includes a callback when the location has been reached? (not AIController but PlayerController)

I was not able to find one and I’m having trouble implementing one myself. I was thinking this is a very basic requirement so maybe there actually is something?

Or what is the best practice here, handling the movement in the Character / Controller before triggering the ability?

Thanks in advance!

Edit: I was wondering whether the way to do this was using a GameplayEffect but I changed my mind on that.

In the Lyra game, the closest they use is Ability Task Apply Root Motion Move to Actor Force which has an On Finished event dispatcher. You could probably take inspiration from that and make it work.

The task is defined in D:\UnrealEngine\UE_5.0\Engine\Plugins\Runtime\GameplayAbilities\Source\GameplayAbilities\Private\Abilities\Tasks\AbilityTask_ApplyRootMotionMoveToActorForce.cpp so it seems to be built-into the default engine gameplay ability plugin, so you might even be able to just use that as-is?

I will definitely take a look at it. But a dedicated “actor move to” task that makes use of navigation would be perfect for a top down settled game. A callback is kind of essential if the move to is just a preparatory task before actually activating the ability / applying effects.

There is a move to location task but this just interpolates the position over time, effectively sliding the actor across the floor without any animation. I guess this should be used for minimal movements to slightly correct the position before triggering an ability.

I’d just like to know if things as positioning should actually be implemented inside a task or done before entering GAS at all.

You could look at the code for the existing “move to” actions, which do have callback, and do something similar for pathfinding navigation then!

The GAS is all about enabling/disabling/triggering/reacting to things. It’s not about physics. But, the path finding movement is a triggered “action” that then does the physics internally, so it’s not against the system to trigger movement through GAS. Similarly, there are examples out there that put things like “dash” or “double jump” into GAS abilities.