3 Ways to Make a Sniper Scope in the Godot Game Engine!



Support the Channel: patreon.com/ChaffGames

Check My New Course : https://www.udemy.com/course/building-a-better-jump-in-godot-4/?referralCode=E852A97F2A35C087FC40

Get the FPS Template Here: https://chaffgames.com/fps-game-template/

The Guns I use:

A few weeks ago I was inspired by Garbaj to do a full investigation into the different techniques to make a Sniper Scope in the Godot Game Engine. These are the three that I eventually settled on.

1. Overlay. This sniper scope is a simple UI overlay that sits over the screen and the camera just zooms in.
2. Picture in Picture. Using Godot’s Viewport feature. We can render a viewport texture to a mesh acting as a Lens on our Sniper Scop.
3. FOV. We can use a optical illusion to make it seem like the gun is sitting right in front of the PLayers Face, when in reality, it’s actually furhter away.

I’ll go over all 3 different ways to make a Sniper scope for the Godot Game Engine.

Gabaj’s Video: https://www.youtube.com/watch?v=NVBS8Lzwbjo&t=4s
Mysterious Purple Cat’s Video: https://www.youtube.com/watch?v=BUzLAXZmFbE

Please like and Subscribe! It’s truly appreciated

#GameDevelopment #GameDevTutorial #Godot

Links to my Socials

Instagram: https://www.instagram.com/chaff.dev/
Twitter: https://twitter.com/ChaffDev
Itch.io: https://chafmere.itch.io
Website: https://chaffgames.com/

00:00 Intro
01:40 Basic Animation and Code
03:45 Overlay Scope
05:55 Picture in Picture Scope
11:03 FOV Scope
13:20 Outro

source

Related posts

Nintendo Switch 2 terá XBOX! HALO, Forza, GEARS e mais

Katamari Damacy Reroll Review

10 AMAZING Upcoming Unreal Engine 5 Games

15 comments

@sammydoodlew January 4, 2025 - 7:58 pm
14:00 This can be avoided by animating the gun camera backward instead of animating the gun model forward. I'm pretty sure that's how most FPS games do that method.
@AnyEscape January 4, 2025 - 7:58 pm
i want this in 2d topdown... the "picture in picture" scope... And i think, this video did help me...
@adog3129 January 4, 2025 - 7:58 pm
the background music is really distracting
@nxidplease January 4, 2025 - 7:58 pm
If anyone is having a problem where they've used MOUSE_MODE_CAPTURED, before adding the ZoomOverlay(CanvasLayer -> Control -> TextureRect) and after adding it it stops working this is due to a setting on the root control node(Hud in the video), go to Mouse -> Filter and select any option other than "Stop" which is selected by default
@ViktorsJournal January 4, 2025 - 7:58 pm
For the 2nd options, instead of script you can probably just use RemoteTransform3D node to update the position?
Btw, there are no cast shadows wit hthe 2nd scope on the enemies? Or are they hidden below?
@lukabrasi001 January 4, 2025 - 7:58 pm
hey, i see you're using viewports for weapons, were you able to make the guns in the viewport receive lights and shadows from the main scene? this is the main reason i ditched viewport weapons man and i can't even find a proper solution to this problem
@CROXoDyLE January 4, 2025 - 7:58 pm
perhaps an issue only with my implementation but I noticed when using the first method, if I swap weapons when zoomed in the canvas layer remains fully modulated, because in my implementation the weapon gets removed when swapping weapons so it cant reset the animation. If anyone knows a work around please let me know.
@bnkm07 January 4, 2025 - 7:58 pm
how to make the sniper rifle itself?
@cesiupro123 January 4, 2025 - 7:58 pm
When I use the picture in picture method, sometimes it works, sometimes it doesn't, and I do it exactly the same way every time. And even if it works, it stops working after I close and reopen the project. The texture isn't loading, the mesh is pitch black. People say it's because both the mesh and the material with the texture have to be set to local. I have both set to local, and the mesh is still black.
@DejaimeNeto January 4, 2025 - 7:58 pm
yes
@jyanjohn7837 January 4, 2025 - 7:58 pm
Please create a tutorial about bullets
@thomasamathew4058 January 4, 2025 - 7:58 pm
I think I commented this on your channel before.
But you've seen display panel that a gun has to show ammo, I guess.

A tutorial on that would be amazing.
Thanks for your videos.
You are an asset to the Godot community.
@MajatekYT January 4, 2025 - 7:58 pm
Wouldn't a picture-in-picture scope method be doable without any performance hit by simply setting the main viewport render target to a texture, use that texture as the main view, then render the rifle and scope on top with a second viewport and have the scope reference the texture that you already rendered to? That way you're only rendering the whole scene once, really. I'm sure you can avoid making it pixelated by animating the field of view to be lower while scoped in instead of just stretching the texture (or having the scope close to the camera and as a result shows the texture stretched to be bigger due to perspectives). But yeah, thank you for the easy to follow tutorial!
@atomic0914 January 4, 2025 - 7:58 pm
Woop, woop I'm quite early
@epiccomediz474 January 4, 2025 - 7:58 pm
This is really cool finally a tutorial on this topic

Comments are closed.

Add Comment