I’m currently making a M4A1 Gun, I have the 3d model with sights and all, but how would I have it so when I right click it zooms into the sights? I already know how to make it zoom by changing the fov, but not directly zooming into the sights, Thanks!
What do you mean by zooming into the sights?
An example would be the zoom thing of phantom forces ig
Are you talking about the cursor stuff zooming in?
he’s saying aiming. like its normal, but then when you aim your gun is straight and you see through the scope/sights
Hello there!
You can try by creating a LocalScript function that changes the Camera’s field of view (thus, creating a “zoom” effect) when the player aims the gun.
How would I go about doing that, Sorry its been a long time since I’ve scripted in rblx studio
Sorry, I didn’t read the full post.
You mean the part when the gun’s sights move in front of the player’s camera when aiming?
Yes that is what I need, because I’m making a simple but realistic Pve game
I currently do not know how to perform the aiming movement,
But based on a free model I have in an old place, I believe the process uses a combination of constraints to perform the aiming action.
ok ty for all your help everyone ig
No problem.
I created a copy of the place with the models
https://www.roblox.com/games/8587564097/Weapon-Testing
Some things may be broken (since the guns are free models) but the weapons work without issues.
The functions that handle the aiming may be in the “clientMain” scripts in the gun models located in “StarterPack”
Or the simple way is scoping in
Hello Pigioty!
You can easily calculate the offset for the “aiming” effect by taking the camera offset of the weapon and multiplying it by the inverse of the weapons handle/grip CFrame, which is then multiplied by the weapons aiming part CFrame. If you are still confused, take a look at the code block below!
local aimingOffset = CameraOffset * GunHandle.CFrame:Inverse() * GunAimingPart.CFrame
Let me know if you have any questions!
You could do
local CframeOffset = CFrame.new()
local aimCFrame = Gun.AimPart.CFrame:ToObjectSpace( ViewModel.FakeCamera.CFrame)
for t = 1,100,1 do -- could use tween service
CframeOffset = ViewModelOffset:Inverse() * CframeOffset:Lerp(aimCFrame,t/100)
end