How would I make an actually centered FPS ADS system?

So far so good I’ve made FPS view models, made them work, made them animate, but the problem is, I don’t know on how to make it so that the iron sights/z-point sights are actually in the center when the player right clicks to aim. I’ve already checked other articles like this, or this. But they don’t really work well for what I have right now at all.

Does anyone have any ideas?

The standard solution to this for a few years has been to use an “Aim” part above the model of the gun which you can use to center the player’s camera.

You can achieve this pretty easily by multiplying the commutative value of your offset weld C1, by the Inverse CFrame of the weapon handle and the CFrame of the aim-part. This will of course change depending on a lot of factors, or if you are even using the standard Roblox welds.

Here is a well-written guide to help you

I have already read that guide.

I didn’t offset the arms using a weld, I did it using animations, can you help me?

try using this guide: Making an FPS framework: 2020 edition

I’m not sure what your current implementation is, but I’d make a guess that it isn’t exactly a well-put together one if you’re using animation positions for offsettings. I started out doing an approach similar to this as well but eventually realized that making an aiming system would requires extreme eyeballing with animations dedicated to putting the sight at the right position for every single weapon, I resolved it by rewritting the framework to use an “Aim” part, which the entire weapon will be rigged to, and moving the Aim part to a specificed CFrame relative to the camera when not aiming will move the entire weapon and arm accordingly, which means making an aim down sight is as simple as setting an aim down sight CFrame and lerping to it. I’m not good at explaining these kinds of subject so you can look through this quick prototype of the described implementation gun.rbxl (24.9 KB)

2 Likes

I have a few questions in the script which I will ask slowly.

if sinValue > (math.pi * 2) then sinValue = 0 end

why are you multiplying 3.14 by 2? i’m confused

the function is responsible for handling the idle sway using sine waves, the extra check is only there to make the sinValue variable not fluctuate to an extreme number (though the client won’t ever be in a situation where the value would get high enough to matter, it’s more for readability I guess, though I’ll be honest I have no ideas why pi x 2 in specific it’s just something I carried over from the implementations of sine waves I researched)

What is the restPosition? What is it for? Where is it placed? Is it the regular idle animation?

What is the aimPosition? Where is it? Why is it just -3?

the restPosition is the regular idle position yes, the aimPosition is the CFrame the gun is lerped to when aiming, it’s the way it is because I found that value to be the most accurate

How did you make the arm move like a regular breathing idle animation? I found no animations/scripts that play the animation there.

it’s done with the calculateSine function, which returns the sineCFrame the positions are multiplied with, I’d recommend you to do your own researches on the topic of sine as I’m awful with explaining mathematical topics

How would I make the shooting animation without it overlapping the current position of the arms via joint? Or even any other animation? ( I use Blender for animations)

the animations should be able to play normally because they offset the joints’ positions, not part positions, but the provided prototype is rather messy to work with, I highly recommend you to write your own framework using it as a study-case only as there are a lot of cut corners and things to polish up

1 Like

But with a few tweaks, would I be able to use the aim script you made here?

you can but you’d have to compensate for the confusing way I handled rigging with it, you should change the way the weaponbind is rigged from

local bind = gun.WeaponBind
bind.Part0 = gun.Aim
bind.Part1 = viewModelRootPart

to

local bind = gun.WeaponBind
bind.Parent = viewModelRightArm
bind.Part0 = viewModelRightArm
bind.Part1 = gun.Aim 

to make it easier to work with and animate, other than that you’d have to figure out how to do things your way and make changes accordingly, good luck

Why not just set the Part0 and Part1 through the properties instead of through a script?

because putting the weapon into the viewmodel itself is a very bad practice, the WeaponBind is a pre-made motor with the C0 and C1 already set to be at the correct position, which is an inefficient method

Haha, guess I was doing something wrong because I did that. Thanks.

So I have another problem. https://gyazo.com/ea6112fb79545b15f7cba9c9cf0451da?token=8daddbf471386e1f34646dd3ec768255