Adding new function on C++ to existing blueprint

Hi fellow developers,

I am currently trying to get the position of Vive’s Motion Controller using the function GetHandPositionAndOrientation(), but the function is only available on Blueprint.

I would later need the output in vector as an input to do a certain algorithm (made in C++, naturally), therefore I was thinking of using the function in C++, and not blueprint, so that it would be easier to get the output (i.e. connecting both classes together).

Does anyone have any idea on how to do it? Or maybe a better method?

Thanks in advance!

Have you tried right clicking the node and selecting “Go to definition”? That should show you the source and help you to replicate the effect in your own C++ code.

Hi, thanks for your reply! yep I’ve located the class in which the function is defined, but it is located under the “private” directory, therefore I’m unable to access the function.

Is there any possible workaround? Thanks again!

Make a C++ function with the required data as in parameters. Expose it to blueprint. Derive a blueprint class from your C++ class and call the exposed function. Now you at least have the data you need. Not as elegant as using only C++ but should work.

But you should be able to access all engine code…

Hi, thanks for your answer! I managed to get it, but for improvement I really want to write everything in pure C++. I’ve made a slightly better question here:

could you perhaps help me again? I’d really appreciate it!!