All Skeletal Socket Rotation for Z Stuck

Hi ,

Not sure is this a new issue as I have been using bullet projectiles with no issues but I went to configure recoil and when I set up the line trace from my MUZZLE socket I noticed that the traces are all off.

They seem to shoot out either hard left or hard right like it is flipping between a boolean -180,180 based on a relative world location:


(Firing left to right)

The thing is I have not set up anything like that in the logic but this is persisting regaurdless of the weapon skeleton being used (Use same socket names)

In my attempt to troubleshoot I have changed the trace start to another socket to no avail.

I have changed the socket rotation in the skeleton and the bullets now fly out at a different angle but the line trace is still off by that same angle amount point 180 directions from one another.

I have spawned a Niagra system to emulate a muzzle flash only to realize that the flash rotates in the opposite location but on the Y axis?..

Where would you recommend I start with this?

Is there a way to sync this up or view the rotation outside of an event tick and string?

Ill send a video if that helps.

Thanks!

Hey there @anonymous_user_3cf2ac1c! That’s a bit odd, are you making a trace in the forward direction of the socket? It’s odd that the socket’s forward would change, so it might be in the recoil logic. That said if you haven’t set up anything that’s odd. Could I see your firing mechanism BPs?

And yes you can sync it with view rotation when you call the firing mechanism. Many games technically shoot from their face instead of the gun barrels themselves. It’s where “Head glitching” comes from.


This is how the FPS template gun handles it’s forward positioning shots (though you may not have to make the transform, you’ll likely leave it broken into into the updated vector.

1 Like

Absolutely and thanks again for the help!

I’ll post the Firing Sequence here: Youll notices that I added a -90 angle to the Z for the muzzle flash. It was coming out wrong and this was a quick fix. Im sure this is part of the larger problem.



Line Trace:

What else can I provide you? Sorry, this project has gotten semi-complex over these few months and I fear it may take some time to root out this issue.

Thanks again!

1 Like

No worries, I’m getting accustomed to your project little by little haha. Ahhh ok so it’s like I expected, so we’re using the rotation from the socket, which as we saw with the other weapons was inconsistent originally, and you fixed it with the reimporting/editing on the last post right? So the real question here is going to be a fun one so stick with me on this one. The gun only swaps from shooting left to right when you shoot again during the montage right? I’m guessing the socket is rotated to X being left originally, and in the montage it had your guns old rotations on the sockets. So the animation rotates the socket all the way around 180 every time for the montage and sets it back when it’s not.

Take a look at the skeleton, and check the montage animations and watch the sockets for me and see if that theory is correct. If so you’ll have to update their rotations to be uniform and just fire from the right vector instead of forward, or orient them all X forward and that’d work with the code you have now.

1 Like

So I removed the fireing montages and the issue still persists even on the first shot. It is not related to my world postion, as in, I can rotate the PLAYER START ROTATION and the tracers still travel down these “rails” regardless player direction.

For example:
Set player facing West OR East. Start game. Fire. Tracer Heads straight and looks good until I turn.

Set player North OR SOUTH. Start game. Fire. Tracers still heading West OR East.

(To clarify the tracers are not alternating between the two directions, rather it fires in the direction until my character rotation seems to hit some angle threshold, then switches sides.)

It may help to note that I use just a box static mesh outside of runtime and load the skins on Event Play/ Switching weapons. I don’t see how this can affect it as I am loading different skeletal skins with their own Muzzle socket, but I am a noob so…

That’s… weird. So we could instead change everything to based off of camera rotation instead, but that’ll take a bit of changing how you handle these. That also does not fix your muzzle flashes and any particles spawned at the end of the gun from being the wrong direction.

Alright so let’s do some diagnostics to get to the root, then I’ll pitch you the fix.

So this is a bit much, but can you make a quick little arrow gizmo actor, set the arrows as not hidden in game, then spawn and attach it to your muzzle socket? To see where it thinks is it’s forward vector clearly at all points during testing.

Here’s how I handle it, I don’t have multiple guns so I didn’t use sockets. That’s close to one of the only differences between what we have here. I get world rotation instead of socket rotation (which I think might be the issue here) and I also use a float to multiply the forward vector evenly across the board.

Ok some troubleshoots:

  1. Changed Socket rotation to world roation to some very unexpected resutls:
    The tracers now solely fire out West and at different lengths???
    (I cant even begin to guess)



  1. Created arrows and attached to muzzle:
    They flash as if updating every frame as I move but they don’t rotate. (I think thats good)

  2. I Exported and reimported the cube static to make a skeletal mesh, made a socket and ran the following code:

Here are the results:
Using SOCKET Rotation and Location. Muzzle Is on Red Arrow side.

.

Using WORLD Rotation and Location

Tracer extension in engine seemingly not reading rotation correctly, not sure what to do about that.

Really perplexed by this. Hopefully, some learning can come of it.

Thanks again!

No worries! Just to verify did you ever change your multiply pin to a float instead of a vector multiply that I mentioned before? Thought that would have fixed it. It does change how it reacts quite heavily. The forward vector put out won’t just be in X, it’ll be in multiple since it’s world space not local space.

Here’s how to do it:
image

SUCCESS

So mad at myself for missing that little coversion but I am going to blame youtubers for posting videos at 720p :confused:

Thanks again and 5 STARS AS ALWAYS!

1 Like