FVector from FVector, FRotator and length (Vector math)

I hope someone can help me and maybe provide me an easy unreal function I did not find so far.

So let’s say I have a cylinder. The center is point P. (for reference look at the picture). I always look at 90° from the X axis. R is a rotation from the object I am looking at. Now I need the Point (FVector) of T in a specific distance, lets say 2000 unreal units. How can I calculate point T?

Thanks a lot for any help!

This is quite an easy problem to solve depending on what properties you have for the cylinder. Do you have a transform / rotator defining the “direction” of the cylinder, or do you only have a vector?

If you have a transform or a rotator for the cylinder, you can calculate point T using the following:

FVector Point = CylinderCenter + (CylinderTransform.GetRotation().GetRightVector() * 2000.f);

Hi TheJamesh,
that looks good, i did not know about the GetRightVector function. I’ll test it.

For rotation a questions: whats the difference in GetRotation and GetActorRotation? One is global one local?

thanks a lot!

Ok but now the FRotator R is 3D. How to do it then? Add all values for rightvector, upvector etc. Or is there a fast way (that combines all three?)

I’d love to help, but I’m not sure what exactly it is you’re trying to calculate. If the point T is offset by 2000 units in all 3 directions, then you will need to add all three directional vectors, there’s no faster way to do it AFAIK.
Still, if you could explain a bit more what exactly you need, it’d be great :slight_smile: