How to disable rotation of socket ?

I want to disable the socket rotation. I only need the socket position. The socket rotation should be the same as the RootComponent rotation.
I thought i can set the socket rotation every tick (better way?), but i can only get the RelativeRotation of the socket and not the world rotation. I need to set socket worldrotation = rootcomponent worldrotation.

How can i do this?

No one has an idea?

btw, how can i set a socket location/rotation in c++? because Socket->RelativeLocation is a const FVector, so i cant use this property, and i cant find setter functions :frowning:

Background for my question:
I want to attach my CameraBoom to a socket thats attached to my character head. And my character rotates with the camera (bUseControllerRotationYaw = true).
If i dont disable the socket rotation, the socket will rotate my camera (when an animation is played), and the camera will rotate my character and because the character is rotating, the socket will rotates relative to it, so the socket has a new rotation, this will cause the camera to rotate, … and again from the beginning. It will cause my character jerking around the z-rotation axis.
I can solve this problem, if i can disable the socket rotation. (while the character plays animations)

An idea for a workaround:
I create a second socket and attach it to the root. Then i get the location from head-socket, and set it to this socket. This will give me a socket that’s attached to the root with the location from the head socket. (but for this i need to set the location and i dont know how)

I’d just soft attach the camera boom.

That means I would set the relative location and rotation everyt tick instead of attaching it to a socket.

Pseudocode:


FVector SocketLocation = Mesh->GetSocketLocation("CameraSocket");
CameraBoom->SetWorldLocation(SocketLocation);
CameraBoom->SetWorldRotation(GetRootComponent()->GetWorldRotation());

Wow thats great, its soo simple it didnt come to my mind :smiley: Thanks!

But for other situations: There is realy no way to set a socket rotation/location via c++, only with the editor? It seems strange that this isnt possible.

Dammit, this doesn’t solve my problem :frowning:

My character jerking around the z-rotation axis with the recommended soft attach too.

In both cases: It only happens when i strafe in X-axis direction. Strafing in Y-axis direction is not a problem. Thats strange O.o


CameraBoom->bAbsoluteRotation = true;

I found the cause of the problem. Its somewhere else. It has something to do with the network replication.
I think the server wants to adjust the character rotation and that causes the character jerking. (not the camera is jerking, its the character)

I found the solution. Clean TP Character jerking with Network - Multiplayer & Networking - Unreal Engine Forums

Thanks everyone for your help.