Hello,
I have the location and rotation of point A. I would like to find the location of point B which is 10 units away in the direction of point A’s X axis. Can anyone explain how I could do that with Blueprints?
Thank you!
Hello,
I have the location and rotation of point A. I would like to find the location of point B which is 10 units away in the direction of point A’s X axis. Can anyone explain how I could do that with Blueprints?
Thank you!
This sentence doesn’t make sense. What do you mean by “having the rotation of a point”?
Based on this description, we can revise the question as “How to add 10 units on X axis to a given location?”
To do that, simply get your location, whether it’s saved inside a variable or accessed directly from an actor, right click on the yellow output pin and on the menu that pops up, hit the Split Struct Pin
option, drag out of the exposed X component and release it on an empty space on your Event Graph, search for “+” on the menu that pops up and hit enter to place the Add (float) node and you’ll see it’s input pin at the top is automatically connected to our X component. Then type in your desired value, 10 for example, into the other unconnected input pin that should be set to 0 by default. Then drag the output pin of the Add node and release it on an empty space, type in “Make Vector” and hit enter to place the node. Again, it’s X pin should be automatically connected to the result of our Add node. Once that’s done, connect the exposed Y and Z components of the original location into their corresponding pins on the Make Vector
node. You can then set a vector type variable’s value to the result of your Make Vector node, or directly set an actor’s location to it.
However, if you’re not talking about a point but a vector (which your “point” would be the end location of), and wanna add 10 units to the direction it’s pointing at, you can use the Normalize
node, multiply it by 10, and add onto the original location.
If your “point” is an actor’s location and by rotation you mean the rotation of the actor’s you can use the Get Actor Forward Vector
node, multiply it with 10 and add onto the actor’s location.
Hope these help!
Hi, thank you so much for taking the time to explain. As I was trying to write a longer reply to offer a bit more context and explain what I’m trying to achieve, I was able to figure out the solution on my own. Thanks again!