I spent several days trying to figure out how to make sure that when I grab and handle the gargoyle, it behaves naturally, but eventually ends up with Z pointing up (upright position), and I couldn’t figure it out. Looks like there is a lot going on behind the scenes in the physics engine and the UPhysicsHandleComponent, so it always gives me weird results no matter what I try besides what is shown in the tutorial.
My latest attempt was to find the shortest geodesic rotation between the component up vector and the world up vector using
FQuat::FindBetweenNormals(HitComponent->GetUpVector(), FVector::UpVector).Rotator();
and then interpolating to it using FQuat:Slerp in tick when setting target location and rotation for the handler, but no luck.
Any idea how to approach this? The behavior that I’m looking for is when I grab and handle the object, it should preserve the angle that I was looking at the object when grabbing it, but naturally rotate it into the upright position. What I want to avoid is fixing the rotation of the object in the world space which leads to unwanted behavior that enables me to “go around” the object and look at it from different sides while holding it.