Download

Gun Sight Aligner

Updated to v2.0.4:

Chang log:

  • Reorganized code and comments with integration in mind. It now should be easier to visualize what events should go where, when integrating with other projects.

Hey there, bit of a problem after converting to alsv4’s skeleton…

I added all the correct virtual bones, i added the fullbody animbp as a linked overlay layer in als’ animbp, replaced all references to point to the correct linked layer. then reparented the b_character_fullbody as a child of als’ anim man…

Now i get a problem where the gun does not go into ads, just holds the base idle pose. but when aim is activated, the right hand snaps to the head and aims backwards.

Ideas? or more information you can point towards changing the character?

@thelazylion

The character in the 1st image you sent doesn’t seem to be in-game, it looks like he’s in the viewport of the anim BP or the anim viewer. Only when he is in-game, and with the gun in his hands, the positions of the gun sights are calculated (CalcSightsTransforms) and sent to the anim BP. If I look at my character aiming in the anim BP viewport, I get a similar result to yours:

So don’t forget to bring CalcSightsTransforms to your gun BP (and call it when the gun is attached to your character’s hand) and test your character in-game. If you’re getting similar results in-game, there could be something missing in the CalcSightsTransforms implementation.

I haven’t tried yet to apply the Gun Sight Aligner to the ALS character (will probably try it when I have some time), but I believe it should be possible.

That screen shot is of the anim bp, but Ingame.

There is a preview feature for debugging, while the game running in editor, you can select from a drop down at the top, a list of active anim BPs being used in the world… and it’ll mimic what is playing in game.

So yeah it does the same in game…

I’ll look until the calc sights implimentation, thanks for the heads up on that.

I just reparented the class over the als one. So I assume it’s in the the anim bp I missed.

CalcSightsTransforms is in the gun bp, it needs to be in your gun bp (or your gun bp’s parent class) and be called after the gun is attached to the character’s hand. The Gun Sight Aligner’s example character attaches the gun and calls its CalcSightsTransforms at EventBeginPlay. CalcSightsTransforms contains a ref to the hand bone - hand_r - and if your bone has a different name, you need to change the ref to match your own bone name, although I think the ALS character’s hand bone name is also hand_r.

Not sure whats wrong then, since I’m using the same example classes. I just parented the character under the als character, setup the anim bp and virtual bones, and the screenshot was the result…
and yeah bone names are pretty much the standard.

@thelazylion:

Check if:

  1. ClacSightsTransforms is actually producing transforms: After attaching the gun to the hand, use a PrintString node to print the length and values of the SightTransforms array, which is filled by CalcSightsTranforms. Length of 0 means that CalcSightTransforms isn’t working (or the gun has no tags or aimpoint sockets). Note: the Aim event of the product already includes a check to prevent trying to aim when this array is 0, but your character is already aiming in your pic, which tells me your array length isn’t 0.

  2. The anim BP is actually receiving and using some value of this array: Use PrintString nodes in the anim BP to check the RelativeToHandLocation and RelativeToHandRotation values. They must be the same as the values in the SightTransforms array.

thanks for the info, looks super useful. I’ll get back to you with any updates…

Thx again

Still happening., removing and re adding to project seemed to work with the default anim bp, even using the alsv4 skeleton/mesh. However I think due to a natural 2-3 degree offset in Alsv4’s system, the aim is off by about a few degrees when ads’ing by default. This isn’t too much of an issue. I’m just adding a 2-3 degree offset on any optical sight. Or maybe I’ll just add a base offset at the end of the animbp…

The issue is when the animbp is replaced with alsv4’s animbp and everything is copy pasted over, including events, and references to the animbp are changed, the aim always just reverts to 0,0,0 on his head.

Even though calc sight transform is printing a decent offset in the anim bp, i attached the calc sight on aim as well just to make sure, however still the same results as posted above.
[Edit on the above]: Seems a macro didnt get copied over for the sight transform in animbp…

Thanks again for the help…

Another, quick (or possibly not) question while I move onto the next module of the project.
If I want to set the mesh as the root, instead of the scene, what would be the correct process of doing this with the least amount of unnecessary overhead?

Thanks again in advanced…

Would it be possible to add a tutorial on how to integrate everything properly in ALS? It would be super helpful, thank you :smiley:

In your gun bp, in the “Components” panel (the one on the top left corner where you see your components hierarchy), just drag the mesh on top of the DefaultSceneRoot, and it will become the root automatically.

Now about your issue, it’s been resolved if I understand correctly?

I need to try and integrate it with ALS on my end first, to see what issues might come up. When I have the time I’ll try it and, depending of how it goes, I’ll make a guide…

yes, it was a lot of work and to be honest I don’t remember what I did exactly. But I had to add an offset to the calcsights transform in the anim bp to account for the als offset…

Pistols are perfect however rifles that use optic aim are still not centered perfectly. I will keep tinkering

I got the ads portion working great, but when I’m not aiming the gun is pointed above my reticle. So when I shoot, it still goes to center screen even though my gun isn’t. How do I fix this?

@rdograndy

Hey, I’ve just answered your question on the store page:

Please let me know if you have more questions!

Hey @PeaceSells_ Firstly great project, well documented!
I’m trying to port over your animation blueprint code to my own as i’ve got features already implemented, but i’m going piece by piece not to mess anything up, it’s all going well so far except i’m having issues with, what i assume is ‘*pitchperbone’ *I’m finding that my controller pitch is either too fast and the arms aren’t in sync with the camera position, they’re moving, but much slower than the camera.
Do you have any suggestion on how to debug this?

Thanks

EDIT
Seems to have resolved itself, i think it happened when copying over some of the transform bone nodes, i toggled some of the bones on and off and is working fine now.

Hello @insideitall ,

Well, I’m glad to see that the issue resolved itself!

Anyway, it sounded to me like the 1 frame lag you get when you retrieve a bone position from the event graph to use in the anim graph. But from your solution, it seems like it was a different issue after all.

Thank you for reaching out and please let me know if you have more questions!

Hey man, I got it working great for a True first person mode. I’m using the MoveIt plugin with a system similar to ALS’ Overlay system to use traditional First Person animations layered on top and it works GREAT. One question, how do you adjust how close a gun is to the camera when aiming? I tried moving the OpticAimpoint around and it didn’t change that I could see. It’s the one piece eluding me.

@oddjob1138 Nice to hear it’s working great! Regarding your question: in the gun blueprint there’s a customization variable called “DistanceFromCamera”, just play with that!

I knew it would be something simple I was missing. Perfect!