Enemy attack that works like vacuum suction

I’m in a bit of a bind here with trying to look up ideas to have the player get pulled toward an enemy like they’re being sucked into a vacuum (e.g. Dust Man from Megaman 4) but practically everything I’ve Googled so far is for creating a vacuum weapon (e.g. the Poltergust from Luigi’s Mansion). Any ideas? (Note that this is one of three possible attacks by the enemy in question, so it will be selected at random using a behavior tree. Also, it’s for a 2D side scroller.)

Hi, can you elaborate a little bit more?

  • Attacker-> Target → MoveTowards(Attacker) (EX: Player->GroundSlam->TargetMovesCloser)
    • Move Direction Target —> Attacker
  • Attacker->PulledTowards(Target) (EX: Player->GrappleHook->MoveTarget->Punch)
    • Move Direction Attacker—> Target

so these things about who owns the attack and movement. I feel you are asking something like a grapple hook? how to implement or do one ? or other ideas?

Edit:
You can launch player from AI like this

It would be more accurate than using force additionally you can do on tick movement like a magnet.

If you are using GAS there is quite nice root motions already integrated.

I should note that I’m referring to the enemy character (specifically a boss) activating a function in its attack barrel which instead of firing a projectile creates a vacuum that pulls the player toward itself, which the player then has to counteract (typically by facing the other way and moving like normal so that they’re against the wind (or so to speak) and their constant attempts to move in the opposite direction of where the vacuum suction is coming from counters the enemy’s attempts to… well, suck ‘em up).

Great understood.

In ability system there is a apply root motion with constant force is exactly what your are looking for.

If you are not using gas for the boss prototype, you can apply launch with some intervals however I feel Add movement input would be a better feeling like player is still in control.

AddMovementInput(Direction, VacuumStrength)

So when you barrel hits ground, get all pawns in radius (collision)

Direction = Normalize (SelfLocation-TargetLocation)

OnTick (OrTimer)-> ForEach (Pawn in Pawns) AddMovementInput(Direction, VacuumStrength)