Download

How would I convert this blueprint to C++

I am trying to convert my linetrace blueprint into c++ but running into some trouble just getting my FVectors set up.

My Current blueprint looks like the following:
Capture.PNG

However, I am having trouble getting the location and forward vectors of the CapsuleComponent of the Character and then doing the math.

Could someone guide me in the right direction to start converting this blueprint to c++?

On components you’ll want to use GetComponentLocation and GetComponentRotation.

Not quite sure what you want to accomplish but for me blueprint is just not readable, C++ code is using less line of code compared to a blueprint class in my opinion.

Anyway if you have for example you can get the Rotation vector from a actor by calling this GetActorRotation()

auto Location = X->GetActorLocation();
auto Rotation = X->GetActorRotation();

// Get the direction vector & normalize
auto Direction = Rotation .Vector();
Direction.Normalize();

// Compute forward vector by 100 units
auto NewLocation = Location + Direction * 100.0f;

Thank guys, and I agree, sometimes these blueprint networks get crazy. It has been a while since I have used c++, must have been about 8 years ago. Anyways, I was mostly having trouble figuring out the equivalents for the world locations and adding them.