How to Place an Actor in Front of My Character?

In UDK there is this function “>>” that allows me to set the coordinate in front of my Pawn. Now, I was wondering what the equivalent function of this in UE4?

Thanks in advance…

Do you want to spawn another Actor infront of “MyCharacter”? Sorry, i haven’t worked with UDK. (: Maybe we can get your problem solved anyway.

No… I just need to get the coordinates a few units in front of my pawn. For example, my Pawn is at X 10, Y 5, rotated 20 degrees in the world. Now I want to know the coordinates of a point 20 units in front of me.

We could also say I want to spawn something 20 units in front of my pawn, wherever he is facing, so basically we’ll need to get the coordinates first.

Thanks :slight_smile:

It’s 6am in the morning now so i can’t help you with an example but how about getting the forward vector of the character and multiply it by 20?

Its pretty simple.

lets say you want a point N units infront of your character. You simply do this:

Normalize(Pawn->ForwardVector) * N.

Now if you want to make sure that the point returned is ON the ground, then all you have to do is do a Trace downward from the location returned by the above equation.

PS:Notice that this method gives you a point N units infront of your character’s current orientation. So it depends on your Pitch as well. If you want to ignore the Pitch, do this:
Normalize(MakeVector(Pawn->ForwardVector.X, Pawn->ForwardVector.Y, 0)) * N

try this and let me know if it works

That’s ok… I’ll learn about the Forward Vector, how it behaves and how to use it.

Thanks!

Thanks for the reply. I am trying to convert your formula into BP and

is what I did. I used the E key to activate the solution. From your formula, I added the result to my Character’s current location.

In my Print node, so far, it is giving me a constant change of 100 units wherever I face my character (sometimes with a 99.9999 difference, but I guess a small point difference doesn’t matter).

Can you confirm if I translated your formula right (or you have other design in your BP)?

In any case, I think my problem is solved… Thanks!!!

2 Likes

Yeah i’m aware of the Z-Axis, I’m considering in the future that sometimes I will have to place things in front of me with higher or lower elevation so I will do something about it in the future. And yeah thanks for pointing the Vector * Float, I think it will make my inputs more simplified. Thanks :slight_smile:

This seems ok. But you know that you are ignoring the z axis? You could also use the Vector * Float node to multiply a float directly to the vector. If you don’t need this you now at least know that such a node exists :smiley:

You could, for example, get the point thats way over this one by adding something to the z axis. And instead of usinf that point, you could use this new point to start a linetrace dirctly to the bottom below and use the hitpoint for your point. That will get you points that are higher or lower than the feet of your character. (:

Thankyouuu

Thank you Ranz!!

Thank you, it is useful

Almost 10 years later and still useful. Thanks!