Hey guys, first thank you for helping and I appreciate any help! I’ve searched Youtube, Google, Unreal Forums ,etc to try and understand where I am going wrong.
I’ve messed with all the rotation settings for about 8 hours and just can’t get this to line up correctly. Usually I stumble upon a solution while either messing with settings or searching online, not this time.
I am trying to get a simple line trace to fire from my AiEnemyCharacters Gun Mesh. I set up a Socket in the bone on the muzzle. I can see the line trace fire from the character but its in the wrong direction. Should be easy fix, just change the rotation of the socket? Nope that doesn’t change the rotation of the line trace… So i rotate the mesh to see if thats why its firing the wrong way… and thats the issue but if I zero those rotation values now the mesh isn’t aligned with the character movement. it fires in the right direction but now my character is moving side ways.
Ended up solving this myself, just incase anyone runs into the same problem, i attached a screenshot of the code and a video showcasing the result. You need to add getsocketrotation node before the forward vector to access the rotation. It was still firing sideways so i had to change the rotation to center the linetrace to centermass on target.
I also wanted to add that if you’re trying to trace between two sockets, for the starting point you only need the location, but for the end you need to combine both the forward vector and the location so that it aims in the correct direction.
This is an example of my sword trace between two sockets on the sword mesh:
Without the forward vector, the trace ends up aiming in the wrong direction, but ending at the correct distance. You’d think juset getting the location would work because in Math a vector contains both the direction and the length. The reason this fails is due to the rotation of the socket being relative to the bone rotation, so you need to get the forward vector to correct the rotation.