Download

Problem with creating "Weapon Drag"

Hello.

I’m not sure how to describe it , but i will try to do it as best as i can , i also made a video of what i want to make and what i made for better clarification.
“Weapon Drag” as i call it , in the first person shooter games ,is when you move the mouse to left and right or up and down, weapon gets left behind a little bit and takes a little bit of time to adjust . it kinda gives the sense of motion .

I was trying to create this using the BlendSpace 2D , so i made 4 frames for top , down , left and right , and used it in the blendspace accordingly , and i used the “Axis value”'s for “Turn” and “LookUp” input as the driver for the X , Y parameters of the BlendSpace. (“Turn” and “LookUp” are movement inputs defined in the first person blueprint template).

I can say it is working , but it is not as smooth as i want it to be , the values of the axis change so much and so fast that it makes the dragging kinda wiggle around a tiny bit .
If you didnt quite understand what i say , you can see it in the video here , in the first 12 seconds you see “Call of duty : MW3” Weapon drag , which is what i want to make , the rest is my wiggly drag .

https://youtube.com/watch?v=amZwdGelSuo

I tried converting the Axis values to an int value , or floor the value , or set the precision for the float ( i mean for example 1.37281319 to 1.3 with precision 1) , it is still wiggly . can anyone guide me on how to make it smooth please ? thanks in advance.

The UT4 source code includes some nice C++ that would get you started on this (UTWeapon.cpp, LagWeaponRotation()).
The basic idea is to rotate the first person weapon rig manually, based on the difference between their previous rotation and their current rotation.
You might want to try something similar using a lerp or interp to.

To add to what Kris stated, I would specifically use an rinterp as it gives you more control over the curve of your rotation than a standard lerp does.

Have you tried adding a rotation lag to your camera spring arm?

Thanks for the replies. really appreciated.

As i’m a novice in C++ and still learning, i would prefer to do it in blueprint , if possible.

My first person mesh is parented to my camera , and my weapon gets attached to a socket in the mesh when “Begin play” . i tried using “RInterpTo” . but i couldnt actually figure out how to do it with my current setup. Can you guide me on how to do this with setup similar to first person template ?

I dont have “Spring Arm” component in my blueprint , i dont think it is needed in first person , and i want to lag the rotation of the mesh , not the camera . Thanks in advance :slight_smile: