Star Citizen: Bugsmashers! - Shotgun Recoil
Transcript — every row opens the video at that moment
- 00:00:06
[Music] hey everyone welcome to bug Smashers I'm your host Mark aent I'm a senior gameplay programmer here to show you all the awesome bugs that make me cry bye smashes hey everyone we are here in my fun test level of shenanigans and we have a bug today with the shotgun so let's hop in the game and take a look so put a shotgun on the ground and then just going to grab it grab my shotgun and the bug is now should I say when you fire a gun you
- 00:00:56
expect the projectiles to go where you're approximately aiming then you do a recoil so let's see what happens PE as you can see it's not exactly what we expect you know you have the shots lining up towards the center which is where the shell should go but we're also getting some on the very top and our spread is obviously not that bad um what's actually happening here is when we shoot um it's actually emitting the projectiles during The Recoil stage rather than emit Ting them all before we recoil you expect to when you shoot you fire the projectile leaves then you recoil not I shoot recoil then the projectiles leave so we have a slight order issue uh so let's step into the
- 00:01:45
code uh here is our fun uh Legacy uh shotgun um fire mode uh this is all going to get cleaned up in the new weapon system but for now we have this awesome um Legacy code and we actually have multiple phases of our firing we have a setup phase which is when I have my gun we try to figure out where the barrel of the gun's going to be so we could emit the projectile there and then we have a recoil phase where after we have emitted we need to now create the muzzle effect and any interesting Trails so we could have a separation and unfortunately the this little fun wol right here is the thing that controls when we actually fired so when we come
- 00:02:34
into this fun little bit of code we basically shoot but we don't created a projectile yet and because this bull is true we now emit The Recoil before we even got to The Recoil phase so what we want to do is remove this so when we shoot we have yet to create the projectiles because um they're deferred spawn so they may not happen right then and there we need to make sure that they they all uh we do the fired phase during The Recoil and it should just be as simple as in The Recoil phase then we mark it as true so what this should now do I'm going to hit recode is I fire the gun it's going to prep um spawning some uh let's see where's that at
- 00:03:23
so this guy so we fire it we prep some projectiles that we're going to spawn they get spawned in the Deferred spawning process when it happens we get this call back and we should be in the setup phase where we're going to emit the projectiles then once they've all emitted we go to The Recoil phase which is now going to spawn the muzzle effect and pretty particles and then we signify during that recoil phase we want to do the popping of the gun up so let's see what happens now ha it's as you specs now all the projectiles get emitted then The Recoil phase occurs and you get the actual shotgun working as intended not Nerf because my projectiles are going
- 00:04:12
all over the place hope you guys enjoyed until next time so we had one of those Infamous bugs where having a variable in one spot versus another spot just brings completely different Behavior Uh you have your shotgun and you shoot it you expect the gun to shoot the projectile at where you're aiming then recoil up not shoot the gun recoil and then emit the uh projectile so just moving that simple bu into a completely different spot so it makes sure that we marked it it's fired after recoil resolve the issue and now we shoot where we expect then recoil hope you guys enjoyed until next time thank you for watching so if you want to keep it with the latest and
- 00:04:58
greatest and star czen of Squadron 42's development please follow us on our social media channels see you soon
Transcript from YouTube’s automatic captions — punctuation and Star Citizen jargon are approximate. The video itself is hosted by CIG on the official channel.

