[C++]Reference pawn components in controller

Thank you for the information. I made a rts style camera with blueprints. And from there I’m trying to switch it to C++ for practice and getting to learn the coding syntax. I didn’t even think of that though. It would be a lot easier and cleaner using and calling a function.

Hello, I’m sorry for this question I’ve been looking for a solution for a couple hours now. I’m coming from web programming to c++ so I’m having some challenges.

So I have a pawn class setup with a hierarchy of components sceneroot->staticmesh->springarm->camera. So the issues that I’m having a problem with is that I’m trying to reference the springarm of the pawn in a controller class so that I can adjust the targetArmLength and stuff like that.

I hope the question isn’t confusing.

Thank you in advance!

There many functions to get component functions in AActor, explore it:

Like those:

Remember that those will loop thru all components in actor so don’t use it in tick and try to do it only once (keep refrence of component)

But i think design wise (and i don’t know why you trying to do it) I think it would be more cleaner to make function in your pawn that operates that arm component and then you can call direly from pawn