Realistic Sniper Shooting: Bullet Drop - Unity Tutorial #1

  Рет қаралды 27,669

Shaded Technology

Shaded Technology

Күн бұрын

Пікірлер: 65
@aniketashis670
@aniketashis670 4 жыл бұрын
Continue the series I will surely watch
@princess-celestia
@princess-celestia 4 жыл бұрын
Ah, this looks great! I'll give it a try the next time I boot up Unity.
@kulak8548
@kulak8548 3 жыл бұрын
Amazing tutorial! I really want to see part 2!
@aethenwulf4757
@aethenwulf4757 3 жыл бұрын
Damn I found gold channel! keep up the good content! (KZbin recommend you, not even searching for gun tutorial)
@ReddLolz
@ReddLolz 4 жыл бұрын
we need part 10, love it
@the_hateful_n8383
@the_hateful_n8383 3 жыл бұрын
You are a god among men...
@GabeAigner
@GabeAigner 3 жыл бұрын
I'm very interested in part 2. When does it come?
@shadedtechnology5198
@shadedtechnology5198 3 жыл бұрын
I haven't had time lately, but I think I should have more time to record it in January.
@ashtongiertz8728
@ashtongiertz8728 7 ай бұрын
I wonder if it would be possible to cast a mathmatical graphing formula instead of a ray? With a graphing calculator, we could set yaw to match the player's rotation, roll to 0, and pitch could be expressed using the formula z = h + xtan(α) - gx²/2V₀²cos²(α), with z being height, x being distance, h being the hight the bullet was initially fired from, g being gravity, and a being the pitch angle. Theoretically, this method should allow the entire bullet path to be calculated instantly, while creating the illusion that the bullet is affected by physics.
@shadedtechnology5198
@shadedtechnology5198 6 ай бұрын
Fir this to work you would have to integrate it to unity physics system or build your own, ray casting in unity is pretty optimised, so I think casting rays allong this precalculated parabola is a good compromise ;)
@LettuceBunnies
@LettuceBunnies 5 ай бұрын
You need to adjust sensitivity when in scope mode.
@shadedtechnology5198
@shadedtechnology5198 5 ай бұрын
It is adjusted in the SniperRifleManager script: github.com/ShadedTechnology/SniperShootingTutorial/blob/master/Assets/Tutorial_1/Scripts/SniperRifleManager.cs#L23
@mythomaniac9903
@mythomaniac9903 3 жыл бұрын
I have the same issue as ItsCazz. The bullet prefab will spawn, but literally nothing else happens. It just doesn't move, and that doesn't really make sense. Edit: Never mind, I fixed it. I did not set the isInitialized bool to true.
@doomguy987
@doomguy987 2 жыл бұрын
how do you script scope adjustment ? like if i press "n" than scope will be set to 200 meters.
@eladonstar2721
@eladonstar2721 3 жыл бұрын
This tutorial will continue?? Shall I Subscribe and wait??..Plus we need a custom marker to show the where the bullet will exactly hit ...
@shadedtechnology5198
@shadedtechnology5198 3 жыл бұрын
Hi, yes this tutorial will continue, I made second part you can watch now. Thanks for idea with hitmarker I will surely consider making it.
@Qaksito
@Qaksito 3 жыл бұрын
I did it differently. I made a script for the gun where places the prefab of the bullet on the barrel of the gun and rotate this center to the center of the camera. The bullet, then, I put a rigidbody with the real weight of the bullet calculating that 1 gram = 0.01 of weight in Unity, and in the script I made an AddForce to forward, with a public speed variable, in which I put the actual bullet velocity * 10
@blueshieldgameproduction3573
@blueshieldgameproduction3573 2 жыл бұрын
Hi, i traied your script, works fine, but i'm trying to make different tipe of projectile now like: shotgun buckshots, rockets, full metal jacket, ecc; so i trayied to make your bullet script a base class and to make some subclassed scrip using virtual void and overrid; but i don't know why i can't pass the raycasthit from the parent script to the child script, please could you tell me a way to subclass a RaycastHit?
@ashtongiertz8728
@ashtongiertz8728 7 ай бұрын
Code dabbler here! Perhaps instead of a subclass, try making a "spawner" entity that executes the raycasthit script with various modifiers, eg the shotgun spawner class executes the script multiple times with random adjustments to the pitch and yaw. Buckshot is a subclass Rockets I've never seen use raycasting in the first place; every rocket launcher I've seen uses the physics engine. It's the only way due to rockets being significantly larger than bullets.
@bhanukadasanayaka3457
@bhanukadasanayaka3457 3 жыл бұрын
Thank You So much!!!!!❤️🇱🇰
@mrmeme6033
@mrmeme6033 3 жыл бұрын
How to make scope
@CreativeOven
@CreativeOven Жыл бұрын
Hey but so does the bullets follow a perfect parabolic trajectory or what?
@log9700
@log9700 3 жыл бұрын
now add wind
@bzmind_
@bzmind_ 3 жыл бұрын
Great tutorial, but I didn't understand how does the FindPointOnParabola works, I mean the calculations that u did for the "point" and the "gravityVec", I don't understand why did u even multiply them together, did u use any physics formula? I'm actually confused, I'm just guessing, and if u used any formulas, can u please tell me what are those formulas, and also what things do I need to know, I mean the physics related stuff that I should know, in order to fully understand these multiplications and other stuff that u did ...
@shadedtechnology5198
@shadedtechnology5198 3 жыл бұрын
"point" is the position of the bullet without the gravity force. "gravityVec" is the displacement vector of the projectile by the gravity. When I add them together I get the position of the bullet with applied gravity force. Those are calculated just using the uniform motion and uniformly accelerated motion formulas.
@bzmind_
@bzmind_ 3 жыл бұрын
@@shadedtechnology5198 Thanks for your help, great tutorial
@alfaaz7146
@alfaaz7146 3 жыл бұрын
@_M_ can you please tell me how the ParabolicBullet script is working. Because in the beginning we are setting isInitialized = true. Then in each update and fixed update we are typing if(!isInitialized) return; how can these functions work after this Statement because !isInitialized will always return false.
@bzmind_
@bzmind_ 3 жыл бұрын
​@@alfaaz7146 So the isInitialized is always true right? so the (!isInitialized) says if isInitilized == false, then return out of this method, but it's not false, the value of the isInitialized variable is true, so it doesn't return, it continues to the next lines, that if statement is like checking: if (isInitialized == false) return; it checks if the value of the isInitialized variable equals to false, which is not, the value of isInitialized is set to true at the beginning as you said we just put that "!" sign at the beginning to make the statement shorter so it becomes like: if (!isInitialized) return; Did I understand your question right? I don't know if you meant this...
@alfaaz7146
@alfaaz7146 3 жыл бұрын
@@bzmind_ Sorry bro! I was actually too much tired and stressed that time and Asked that Dumb question without even noticing Thanks for your Reply. 🙂 And yeah, one question, How is this Bullet supposed to go straight always? Because in almost all FPS games the Gun is not always in the center and pointing forward, the gun is actually Somewhat rotated to left or right e.g if the gun is on your right side (like in most Games) then it will be pointing a bit left side. Now, if I instantiate the bullet at gun's direction, It'll definitely go to the left side of the gun, which is not center (and we want it to go center of the screen) that's why I am used to give my bullet a Direction by Casting a raycast from my active camera's center to forward, and if it hits anything I calculate the direction as Vector3 c = hitpoint - bulletEjectionPosition (hitpoint is the point where raycast hits) And then set my Bullet's transform.forward to c (normalized) that I just Calculated. But in this Tutorial he's just instantiating the bullet at gun's rotation. The Question is, If my Gun is Rotated as I explained, will this Tutorial Work??? Or I have to Set my forward direction by calculation as I'm used to do?
@nobody-tw3zs
@nobody-tw3zs Жыл бұрын
Underrated
@itscazzz297
@itscazzz297 3 жыл бұрын
Im having trouble with my code. when i go to playtest the game and try shooting, the bullet prefab spawns, but it is off center and doesn't move. I have assigned the parabolic bullet script to the prefab and i have assigned the shoot point to be an empty object that i have at the end of the barrel. Any help would be appreciated.
@itscazzz297
@itscazzz297 3 жыл бұрын
so i fixed the bullet be off center when it spawns, but it still wont move. and i have assigned the parabolic bullet script to it.
@mythomaniac9903
@mythomaniac9903 3 жыл бұрын
I had the same issue. Did you set the isInitialized bool to true?
@YadroGames
@YadroGames 3 жыл бұрын
Power HELP: Thank You Janob
3 жыл бұрын
Guys, in my project I spawn an object with rigidbody and cast a ray, the rigidbody do the drop and the ray collects data, is that good, i mean, does it use low resource, right? pls respond xD
@shadedtechnology5198
@shadedtechnology5198 3 жыл бұрын
This is also valid way to do this (casting ray between current and last rigidbody position), but making your own system you have better controll and for example you can predict immidietly the path of projectile.
@MaoriNative_NZ
@MaoriNative_NZ Жыл бұрын
Hey man is this a game on steam? Im looking for range shooting games with bullet drop like this one.
@shadedtechnology5198
@shadedtechnology5198 7 ай бұрын
Hi, no I don't plan to release this as a game yet, just a side project. If you want to play with it, you can download the project from github and open in unity :)
@valgardviggo8209
@valgardviggo8209 3 жыл бұрын
thank you sooo much
@fabianobersovszky6987
@fabianobersovszky6987 Жыл бұрын
The projecitle goes through walls if i set the speed to 400 and shoot close objects. How could i fix that?
@shadedtechnology5198
@shadedtechnology5198 7 ай бұрын
Hi, without looking to your project and debugging I can't tell for sure, but maybe your shooting start point clips through the wall and the raycast starts inside the wall.
@walney2008
@walney2008 3 жыл бұрын
hello, I would like to learn ship control, as in the game world of warships, could you explain?
@mariotudon7982
@mariotudon7982 2 жыл бұрын
If I want the bullet not to make a parabola, I just have to remove the gravityVec line?
@shadedtechnology5198
@shadedtechnology5198 7 ай бұрын
Yes, or just set gravity force to 0 :)
@JimBob-jp6bv
@JimBob-jp6bv Жыл бұрын
Hi, I know I'm a bit late to the party, however when the bullet prefab is spawned, the next point goes up instead of down, thanks
@JimBob-jp6bv
@JimBob-jp6bv Жыл бұрын
Just realised what I did - I set the gravity scale to -9.8f, but since the vector used is Vector3.down, short for: new Vector3(0,-1,0) when you times a negative by a negative it equals a positive, so simply by switching from -9.8f, to 9.8f this fixed my problem!
@pascal1823
@pascal1823 3 жыл бұрын
Very cool
@atomichorizen3987
@atomichorizen3987 Жыл бұрын
So after watching and implementing this.. why are u using raycast, the point of them in a FPS type game is so when u are shooting, the crosshair which is at the centre of ur screen is always where the bullet shoots from, and calculates if a viable target is within the centre of the screen via the raycast. what u have managed to do, is a more complicated version of a projectile bullet system, similar to games like Escape from tarkov etc. where it is shooting a rigidbody bullet from the tip of the barrel roughly to the centre of the screen, but sightly more off if u arent ADS'ing. if ur not wanting to use on collision / trigger enter for a projectile bullet then fair point, they can be buggy at times and not trigger. so why didn't u just use say a ray sphere cast that emits from the projectile bullet that u are already sending out. whilst I am impressed with this method, I'm confused on weather u are trying to demonstrate projectile shooting with raycast, or attempting to use hitscan but end up using a frankenstien version of the both. not even common hyrbid like what some of the Halo games use
@shadedtechnology5198
@shadedtechnology5198 7 ай бұрын
Hi, I explained it in 0:50, basically rigidbody phisics with colliders is not consistent with such speed and in most cases bullets would fly through the walls. I think games like Escape from Tarkov also uses simillar techniques (ray casting).
@ashtongiertz8728
@ashtongiertz8728 7 ай бұрын
The reason hitscan is commonly used for bullets is because it's easy to calculate. This is especially important for multiplayer games where you have to deal with lag compensation, something projectiles can't do. Also a bullet-sized projectile traveling at the speed of a bullet would probably pass through hitboxes too fast for the game to register collision.
@alfaaz7146
@alfaaz7146 3 жыл бұрын
Edit: Now it is really driving me Insane. I just tried using it in my own Project and when I was typing the scripts I noticed that in Projectile Script you are setting isInitialized bool to True in the very beginning. Then, in Update and FixedUpdate you are typing if(!isInitialized) return; how are these functions supposed to work after this Statement??? Because !isInitialized will always return false. Old commen below: Can you please explain me how this is working??? Because mostly in all fps game the gun is not in the center, it is in the right or left. When we instantiate a bullet at gun's position and rotation it will not go forward. It'll go to opposite direction on Gun. And to make it look forward we have to take direction c as b-a where b is the hit point where we want to hit and a is the bullet ejection point. I'm kinda confused here. 😥 Can you explain this please. Plus: liked your stuff and subscribed. It's awesome and really deserved like.
@shadedtechnology5198
@shadedtechnology5198 3 жыл бұрын
This variable "isInitialized" is false at the beginning, so the code in the Update and FixedUpdate functions is not executed. Then after we initialize values, this bool is changed to true and code in update is executed. I hope this helps 🙂
@alfaaz7146
@alfaaz7146 3 жыл бұрын
@@shadedtechnology5198 Thank you! I really don't know why I even Asked this Dumb Question. That was really Dumb!!!!! Maybe due to the stress, as I was working for straight 16 Hours now. Well, My Update and Fixed Updates were not working. I even logged them and they work before that condition but the Debug after that Condition isn't working. The problem is something else, I'll try to figure it after a long break, because I'm too much stressed now. 😂 Plus, Again Sorry for that Dumb Question, my mind wasn't working when I asked that. Wish you a good day. ♥️
@shadedtechnology5198
@shadedtechnology5198 3 жыл бұрын
There are no stupid questions ;)
@alfaaz7146
@alfaaz7146 3 жыл бұрын
@@shadedtechnology5198 🖤 Thanks Mate. ♥️
@Sp8dezz
@Sp8dezz 4 жыл бұрын
pls make a pistol now i rlly need it like the one in karlson just search dani karlson and youll find alot
@shadedtechnology5198
@shadedtechnology5198 4 жыл бұрын
Hi, I've seen Dani's Karlson, you can make your pistol analogically to this sniper rifle just by replacing the model and animations. But I could make some day a series about making pistol shooting game. Btw I am making next video about adding wind force to the bullet as well as ricochet and wall penetration, so stay tuned ;)
@Sp8dezz
@Sp8dezz 4 жыл бұрын
@@shadedtechnology5198 k thx!
@wolfsmith9342
@wolfsmith9342 3 жыл бұрын
Ricochets Please
@shadedtechnology5198
@shadedtechnology5198 3 жыл бұрын
I will make ricochets in the next part ;)
Procedural Recoil System | Unity Tutorial
15:39
Gilbert
Рет қаралды 161 М.
Realistic Sniper Shooting: Wind - Unity Tutorial #2
5:55
Shaded Technology
Рет қаралды 4,8 М.
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 21 МЛН
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 113 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,4 МЛН
the balloon deflated while it was flying #tiktok
00:19
Анастасия Тарасова
Рет қаралды 35 МЛН
How to code SMARTER A.I. enemies | Unity Tutorial
32:49
This is GameDev
Рет қаралды 58 М.
Awesome Third Person Shooter Controller! (Unity Tutorial)
36:10
Code Monkey
Рет қаралды 551 М.
How to Make People Love Guns
23:24
StopGame
Рет қаралды 377 М.
The Most Impressive Scratch Projects
11:00
DenshiVideo
Рет қаралды 5 МЛН
How To Make A Game Alone
16:44
Thomas Brush
Рет қаралды 278 М.
SHOOTING with BULLETS + CUSTOM PROJECTILES || Unity 3D Tutorial (#1)
9:25
Dave / GameDevelopment
Рет қаралды 203 М.
Hitscan Guns with Bullet Tracers | Raycast Shooting Unity Tutorial
11:35
[#05] Shooting a weapon using Projectile Raycasts (with effects)
44:21
C++ Developer Learns Python
9:26
PolyMars
Рет қаралды 2,7 МЛН
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 21 МЛН