calculate player next location

i want to make a bp that will calculate player next location based on his speed or velocity so i can spawn something in that location and he would have to dodge it

Hey @Td1!

That’ll be pretty easy! You can just use “GetVelocity” with your actor as the target, and that’ll output a Vector. That Vector is in “Unreal Units per second”. Then multiply that value by how close you want the spawned actor to be. Think in terms of how many seconds away you want to spawn it, and you can go down pretty low in decimal places.

Then you’ll take THAT value, add it to actor’s current location (in whatever direction they’re moving) and “SpawnActor” with that value as the location. :slight_smile:

1 Like

kinda confused can u give me a screenshot of that if possible

This would be literally what you asked about:

But I’m not sure if you’re asking for the right thing. Plug it in (playerBP), run around, and see if that’d work for you. And then do tell what needs changing, we’ll need to clamp something, surely.

it worked but the thing is it would spawn the trap a bit far than what i want like i want it to be 2 steps behind

You want to drop traps behind the player as they run?

nah , it spawn the trap 2 step far than where i want it to be , its very easy to notice but if it was 2 steps closer it would be harder to dodge

( i want it to be infront the player as it is but closer a bit )

Velocity is a relative vector, you can multiply it:

For the sake of completeness, if you want to use uus:

2 Likes

THX

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.