How to get world rotation of arrow component c++?

Hello,

I seem to be having some issues getting the world rotation of the inherited arrow component in my character class in c++ (No problems in blueprint). It inherits from ACharacter so I know I have the arrow component. The problem is that when I type GetArrowComponent()-> it gives me an error and there are no options after the pointer. Like GetArrowComponent(); works with no errors but obviously that isn’t useful. It’s when I try to add the pointer and try to get some info about it that it has errors. So I guess my question here is, is there a different and more correct way to reference the Arrow Component?

And also I noticed when trying to get world rotation of other components there is something call GetComponentRotation. Would that serve the same purpose as get world rotation? Because I can’t find a get world rotation for any components.

What I’m trying to do is get the world rotation of the arrow component so that I can make the player movement rely on the arrow component’s rotation instead of control rotation (when my character is in “cover” to be specific). Well I hope that helps explain everything. Any help is much appreciated.

P.S. I’m still new to c++ so my apologies if this is a very basic question.

1 Like

Oh wow thanks for the quick response.
The error starts in the IDE (Visual Studio 2015 for me). It shows that the GetArrowComponent() that you have above, is an error, and the project fails to build (so it’s still an error during compilation). I’ve tried waiting for it to go away but it’s a persistent one. Are you doing this in the header or source file (I’m assuming source which is where I put it)? When I hover over it it says “pointer to incomplete class type is not allowed.”
It’s just strange because GetArrowComponent shows up as something I can use. I have no clue why it’s acting this way.

This works fine for me:

FRotator ArrowRot = GetArrowComponent()->GetComponentRotation();

Where do you have this error?
If in IDE (but not during compilation), then it’s VS fault as it’s intellisense doesn’t work well with UE4. You may find false errors in editor and stuff like that. I have to use that thing at work, and it sometimes takes couple minutes to show available properties/methods for objects.

1 Like

Yes, I’m using it in source file. But it also would work if you’d implement some inline function in header too.

Can you show me your full c++ file with header? Or if it’s too big or something, just a declaration of your class, and function where you want to use it and implementation of that function.

Hey it actually is working now. I’m not sure what the problem was but after restarting my computer it isn’t generating any errors. Something must have been bugging out on my computer, but it’s fixed now. Thank you for your help though!