How to get character world location in real-time? Trying to recreate Pathfinder's grapple

I’ve been trying recreate Apex Legend’s Pathfinder/Titanfall 2 grapple mechanics. So far the obvious way seems to be:

  • Get the location where the grapple attaches and promote as variable
  • Get player’s character world location, promote as variable, and have it constantly updated over the course of grapple
  • Utilize “AddForceToCharacter”, apply a force to the character at a vector from the character world location to the grapple attach spot, so the grapple constantly “pulls” the player toward grapple spot while the character world location changes.

However, I don’t know how to have the variable for character world location constantly being updated, and constantly have it pinged by the grapple script so the vector of the force applied to the character changes direction as the character moves around in the world over the course of grapple. Any ideas how I could achieve that? Thanks!

You can have your grapple tick and use your get actor location on your character to get its location as you need it. There’s no need to store it as a variable as you will only need one call to the actor location per velocity update.

Using physics for this is going to either end up being super wonky or require a ton of serious tinkering with the values:

This will increase the pull the closer you are to the target so we do not slingshot beyond it too much.

Image from Gyazo

Image from Gyazo

Might be worth experimenting with if you’re after the next Apex Goat Simulator. :wink:


I think interpolating to target location should be more robust and give you more granular control - think homing missile.