Hand bone (IK) rotation to surface

I started a forum post about this but I haven’t received any responses, thought I’d try to boost exposure to the issue using this place.

Link to forum post (It just reads the same as below).


I am trying to make a character put their hands on a nearby surface.

I have done the IK, so the hand actually moves to the surface. I also have the surface normal vector of the surface at the point where I want the hand to be going to.

How do I convert this surface normal into the correct Rotator for the hand?

I tried using RotationFromXVector, Rotation from X, Y and Z. None of them will line up to make the palm face the surface.

Any help appreciated. Thanks.

Update!

Managed to get the angle I want using “Make Rot from XY” by putting the surface normal into the Y axis, and setting the X-axis as default.
I wish these “make rot from XY” functions were available in C++. If anyone knows how to get them, let me know.

Update 2!

Found the C++ functions.

Do you have a tutorial on this??? I’ve looked at the 3 screenshots. (I’m an animator, so blueprints aren’t my specialty, hehe).

you’ll need to include the Kismet Math library.

#include "KismetMathLibrary.h"

then

FRotator RotFromXY = UKismetMathLibrary::MakeRotFromXY(X, Y);

This library contains all of the rotator functions you’re used to using in blueprint.

Why not using default constructor of FRotator in C++ ?