Download

Unusual Rotation behavior

I have made a power socket and a power plug which I can then pick up and plug into the power socket. I have made it so when I am holding the power plug and I’m in range of the socket and I’m looking at it, the socket will highlight, the plug will rotate to align itself with the socket (but hold short by 20 units) showing that it’s ready to be plugged in. When I then press my interact button, it plugs it in and it seems to usually work well.

My issue is that sometimes, the plug doesn’t plug into the socket on the correct angle. It usually seems to be when I pick up the plug off the floor when the plug is rotated more than 90 degrees from my characters forward vector, it plugs in on a funny angle. If I then unplug and re-look at the socket, it will be aligned nicely. Is there something I’ve done wrong in this blueprint?

This blueprint snapshot is controlling what happens when I look at the power socket when I’m holding the plug. I’ve tried quite a few different ways for providing the New Rotation for SetWorldLocationandRotation but nothing seems to fix this bug. Any suggestions?