GetSocketLocation problem

I’m having some trouble with GetSocketLocation. I want to add a muzzle flash to a weapon and I am able to find the socket. However, the coordinates do not reflect the aim offsets which are applied to the player model. For example, if the player is looking up 45 degrees, GetSocketLocation returns a location that would be correct if the weapon were still level at 0 degrees. Not sure what’s happening . Ideas?

You could be getting the local version of the socket location instead of the world location.
That or you’re getting the socket location from a server which doesn’t reflect the aiming offset.
Without more info or some example of your code, that’s all I can guess at.

It’s the world location. The particle effects spawn at the actor’s location as they should (with the exception of the aim offsets). Also, the muzzle coordinates are taken from the client and passed to the server to avoid issues with the server not knowing what the animation is doing on the client.

You can roughly sync animations between server and client by simply enabling animations to happen when not rendered.
To get them more accurate, you can push the servers animation time & blends to the client occasionally to keep them in sync.
Well, that is how I did it in the past (using UE4/UDK) :slight_smile:

As for you issue, unsure.
May just pay to post up the code in question.
Even if know one finds anything, it often helps you see it in a new light :slight_smile:

Could you tell me how to do this? I need this to fix an issue that is unrelated to this topic. I want to use socket locations of a 3rd person mesh to trace for melee hits, but as a listen server the player’s own 3rd person mesh isn’t rendered so the animations aren’t in effect. :slight_smile:

This problem has me stumped. I looked at the code in the Shooter Game example and there really isn’t any different that I can spot. The weird part is the GetSocketRotation call is working at it should. I just can’t get the correct location from GetSocketLocation. I tried converting the animation from AimOffset to Blend Space. Still doesn’t work correctly.

Hey have you checked if you have set Skeletal Mesh in Character class/ BP.
To “Always Tick Pose and Refresh Bones” ?

Also you may want to look into setting send camera update to true.
is a code snip from my Player Controller class.


if (PlayerCameraManager)
{
	PlayerCameraManager->bShouldSendClientSideCameraUpdate = true;
	PlayerCameraManager->bUseClientSideCameraUpdates = true;
}

This is how i setup my character in order get correct Aim Offest replicated.

Hope this helps you out.

2 Likes

, you’re a life saver. That fixed it. Thanks.

Thats great to hear Whammy, glad to help out. :slight_smile:

Fixed my issue as well. Thx . Tried a lot of stuff until I found this thread :slight_smile: - Just wondering if there is any possibilty to update this only once. Actually I don’t care if the bones are updated except if one client hits the fire button. So it seems it would be cheaper (for a listening server) to call it only on demand and ignore it if it’s not really necessary. However changing the flag before I do my GetSocketLocation was too less.

, I can’t thank you enough!