I am in the process of making an active ragdoll character in ue5.6. I have gotten the ragdoll walking, grabbing, hanging, jumping, and all sorts of fun stuff. But I am currently stuck on how to make the character point towards the camera. Obviously using the pawn's use controller rotation yaw doesn't work as my whole character moves from the pelvis of my ragdoll character.
I've done tons of research on this and the general consensus is to take the cross product from the pelvis angle vector and the camera forward vector. You then use Add Torque to rotate the character towards that angle and then stop the rotation once it reaches the target angle via dot product. Seams nice enough but whenever I take the cross of the two angles I am left with a nice little 0 vector. So obviously nothing happens to the character rotation.
I've tried more shenanigans of using animation blue prints to just rotate the pelvis and that did nothing, I tried modifying the transform with teleport and that just killed unreal, and I've tried all sorts of weird math to try and make things happen but to no avail.
The below image shows something that did rotate the character, but it did not rotate it right at all. The character would sort of rotate opposite, then snap weird, and then shake a ton. The rest of the attempts just return nice little zero vectors so Idk what I'm supposed to do here
I am not a mathematician or physicist by any stretch of the means so I imagine the answer might seem simple to anyone who knows but I don't... so I would greatly appreciate any help that can be provided. Thank you!
Hello anyone who stumbles upon this post looking for what I was but I have figured it out! Essentially what you want to do is something like the below:
https://blueprintue.com/blueprint/lb61cv51/
You want to follow this structure below:
TargetDir = Normalize((CameraPos - PelvisPos) with Z=0);
CurrentDir = Normalize(ForwardVector(pelvis world rot [+ offset]) with Z=0);
TurnSpeed = 5000000;
Angle = crossZ(TargetDir, CurrentDir);
TorqueZ = TurnSpeed * Angle.z;
Apply AddTorqueInDegrees on SkeletalMesh(0,0,TorqueZ);
I hope this helps someone